diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-04-06 00:55:59 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-04-06 00:55:59 +0200 |
commit | 1ed4ac93ae35534397bc8267f255c380ef3193c4 (patch) | |
tree | 1ac441024715ace282ef52587ddcfec678f4d8ed /src/config.c | |
parent | a6a5b5e00e98aa27644a1afa4a461819221b758d (diff) | |
download | fastd-1ed4ac93ae35534397bc8267f255c380ef3193c4.tar fastd-1ed4ac93ae35534397bc8267f255c380ef3193c4.zip |
Add some missing error handling
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/config.c b/src/config.c index f18d975..8c63b4e 100644 --- a/src/config.c +++ b/src/config.c @@ -163,7 +163,8 @@ void fastd_read_peer_dir(fastd_context *ctx, fastd_config *conf, const char *dir read_peer_dir(ctx, conf, conf->peer_dirs->str); - chdir(oldcwd); + if(chdir(oldcwd)) + pr_error(ctx, "can't chdir to `%s': %s", oldcwd, strerror(errno)); } else { pr_error(ctx, "change from directory `%s' to `%s' failed: %s", oldcwd, dir, strerror(errno)); @@ -250,7 +251,8 @@ bool fastd_read_config(fastd_context *ctx, fastd_config *conf, const char *filen fastd_config_pstate_delete(ps); fastd_config_yylex_destroy(scanner); - chdir(oldcwd); + if(chdir(oldcwd)) + pr_error(ctx, "can't chdir to `%s': %s", oldcwd, strerror(errno)); free(filename2); free(oldcwd); @@ -568,7 +570,9 @@ static void reconfigure_read_peer_dirs(fastd_context *ctx, fastd_config *new_con pr_error(ctx, "change from directory `%s' to `%s' failed: %s", oldcwd, dir->str, strerror(errno)); } - chdir(oldcwd); + if (chdir(oldcwd)) + pr_error(ctx, "can't chdir to `%s': %s", oldcwd, strerror(errno)); + free(oldcwd); } |