X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;ds=sidebyside;f=fd.c;h=2ef8e66eb957d48a0783acfb3105c59c5e1201f8;hb=66cdd5bc99a53d2b408a6cdc2d501fe27f9db13b;hp=4ac61709da8a2ddc6b4077cf51c5053d30777dab;hpb=a0b87ba0529cc6ab075e1d7a11f8b4adc47948eb;p=dss.git diff --git a/fd.c b/fd.c index 4ac6170..2ef8e66 100644 --- a/fd.c +++ b/fd.c @@ -1,3 +1,10 @@ +/* + * Copyright (C) 2006-2010 Andre Noll + * + * Licensed under the GPL v2. For licencing details see COPYING. + */ + +#include #include #include #include @@ -7,10 +14,10 @@ #include #include - #include "gcc-compat.h" #include "error.h" #include "string.h" +#include "fd.h" /** * Call a function for each subdirectory of the current working directory. @@ -35,11 +42,8 @@ int for_each_subdir(int (*func)(const char *, void *), void *private_data) int ret; DIR *dir = opendir("."); - if (!dir) { - ret = -ERRNO_TO_DSS_ERROR(errno); - make_err_msg("opendir(\".\") failed"); - return ret; - } + if (!dir) + return -ERRNO_TO_DSS_ERROR(errno); while ((entry = readdir(dir))) { mode_t m; struct stat s; @@ -51,7 +55,6 @@ int for_each_subdir(int (*func)(const char *, void *), void *private_data) ret = lstat(entry->d_name, &s) == -1; if (ret == -1) { ret = -ERRNO_TO_DSS_ERROR(errno); - make_err_msg("lstat(\"%s\") failed", entry->d_name); goto out; } m = s.st_mode; @@ -75,13 +78,9 @@ out: */ int dss_chdir(const char *path) { - int ret = chdir(path); - - if (ret >= 0) + if (chdir(path) >= 0) return 1; - ret = -ERRNO_TO_DSS_ERROR(errno); - make_err_msg("chdir to %s failed", path); - return ret; + return -ERRNO_TO_DSS_ERROR(errno); } /**