aboutsummaryrefslogtreecommitdiffstats
path: root/bin/nfcollect.c
diff options
context:
space:
mode:
authorYunchih Chen <yunchih.cat@gmail.com>2018-03-20 18:06:48 +0800
committerYunchih Chen <yunchih.cat@gmail.com>2018-03-20 18:16:33 +0800
commitb4dad31a95ebb45a44a719b1c190e445ae5b5afb (patch)
treeda58fda61d37eb5b1949417f53c14657d7ea5d3e /bin/nfcollect.c
parenta1ebe8daa40c49621fd33b0c34d99227a0be9295 (diff)
downloadnfcollect-b4dad31a95ebb45a44a719b1c190e445ae5b5afb.tar
nfcollect-b4dad31a95ebb45a44a719b1c190e445ae5b5afb.tar.gz
nfcollect-b4dad31a95ebb45a44a719b1c190e445ae5b5afb.tar.bz2
nfcollect-b4dad31a95ebb45a44a719b1c190e445ae5b5afb.tar.lz
nfcollect-b4dad31a95ebb45a44a719b1c190e445ae5b5afb.tar.xz
nfcollect-b4dad31a95ebb45a44a719b1c190e445ae5b5afb.tar.zst
nfcollect-b4dad31a95ebb45a44a719b1c190e445ae5b5afb.zip
Check chdir, getcwd, fread return errors
Diffstat (limited to 'bin/nfcollect.c')
-rw-r--r--bin/nfcollect.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/nfcollect.c b/bin/nfcollect.c
index 2c88ad1..4168fd7 100644
--- a/bin/nfcollect.c
+++ b/bin/nfcollect.c
@@ -197,8 +197,8 @@ static uint32_t calculate_starting_trunk(const char *storage_dir) {
ERR(!(dp = opendir(storage_dir)), "Can't open the storage directory");
- getcwd(cwd, sizeof(cwd));
- chdir(storage_dir);
+ ERR(!getcwd(cwd, sizeof(cwd)), "getcwd");
+ ERR(chdir(storage_dir) < 0, "chdir");
while ((ep = readdir(dp))) {
const char *fn = ep->d_name;
@@ -213,6 +213,6 @@ static uint32_t calculate_starting_trunk(const char *storage_dir) {
}
closedir(dp);
- chdir(cwd);
+ ERR(chdir(cwd) < 0, "chdir");
return newest_index;
}