diff options
Diffstat (limited to 'src/ckutil.c')
-rw-r--r-- | src/ckutil.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/ckutil.c b/src/ckutil.c index 880696b..a477b36 100644 --- a/src/ckutil.c +++ b/src/ckutil.c @@ -45,19 +45,28 @@ int util_file_exists(const char* path, char *absPath) { if (stat(path, &st) == -1) { return 0; } - if (absPath != NULL) { + if (absPath) { realpath(path, absPath); } return 1; } -int util_is_file_rw(const char* path) { +int util_is_file_rw(const char *path) { if (access(path, R_OK | W_OK) == 0) { return 1; } return 0; } +int util_is_file_link(const char *path) { + struct stat buf; + lstat(path, &buf); + if (S_ISLNK(buf.st_mode)) { + return 0; + } + return 1; +} + void util_mkdir(const char *name) { mkdir(name, 0755); } |