-/**
- * @brief Get the mode bits from the given path.
- *
- * @param path
- * The path (file or directory) whose mode we want.
- *
- * @return A mode_t (st_mode) structure containing the mode bits.
- * See sys/stat.h for details.
- */
-mode_t get_mode(const char* path) {
- if (path == NULL) {
- errno = ENOENT;
- return -1;
- }
-
- struct stat s;
- int result = lstat(path, &s);
-
- if (result == 0) {
- return s.st_mode;
- }
- else {
- /* errno will be set already by lstat() */
- return result;
- }
-}
-
-
-
-/**
- * @brief Determine if the given path might refer to an (unsafe) hard link.
- *
- * @param path
- * The path to test.
- *
- * @return true if we are certain that @c path does not refer to a hard
- * link, and false otherwise. In case of error, false is returned,
- * because we are not sure that @c path is not a hard link.
- */
-bool is_hardlink_safe(const char* path) {
- if (path == NULL) {
- return false;
- }
- struct stat s;
- int result = lstat(path, &s);
- if (result == 0) {
- return (s.st_nlink == 1 || S_ISDIR(s.st_mode));
- }
- else {
- return false;
- }
-}
-
-
-/**
- * @brief Determine whether or not the given path is a regular file.
- *
- * @param path
- * The path to test.
- *
- * @return true if @c path is a regular file, false otherwise.
- */
-bool is_regular_file(const char* path) {
- if (path == NULL) {
- return false;
- }
-
- struct stat s;
- int result = lstat(path, &s);
- if (result == 0) {
- return S_ISREG(s.st_mode);
- }
- else {
- return false;
- }
-}
-
-