diff options
author | gramanas <anastasis.gramm2@gmail.com> | 2018-10-04 01:20:13 +0300 |
---|---|---|
committer | gramanas <anastasis.gramm2@gmail.com> | 2018-10-04 01:20:13 +0300 |
commit | fa41863b03bbf67a7ad4edad9328b0cdc48e497b (patch) | |
tree | e7e4dd5986364c29a3d51ac661ce9b133effc868 /src/ckutil.c | |
parent | bc2899dd69fce0f1868dbfad3394ef8b3dc48069 (diff) | |
download | ck-fa41863b03bbf67a7ad4edad9328b0cdc48e497b.tar.gz ck-fa41863b03bbf67a7ad4edad9328b0cdc48e497b.tar.bz2 ck-fa41863b03bbf67a7ad4edad9328b0cdc48e497b.zip |
store configs in subfolders and error/logging infrastructure
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); } |