summaryrefslogtreecommitdiff
path: root/lib/libalpm/util.c
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2010-06-27 20:32:11 +1000
committerDan McGee <dan@archlinux.org>2010-07-01 00:14:59 -0500
commit5a3aae02fed68379b5ede7abc9c7675632ce403a (patch)
tree917972cda40804c22c076cd3f193e04b93e3630d /lib/libalpm/util.c
parent41724cbcdef11cb00fcd720c75d399288ea41fd0 (diff)
downloadpacman-5a3aae02fed68379b5ede7abc9c7675632ce403a.tar.xz
Check return value of chdir and getcwd
Prevents compiler warnings when building with -D_FORTIFY_SOURCE=2 Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/util.c')
-rw-r--r--lib/libalpm/util.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index fd5bb628..ffebe9e8 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -372,8 +372,8 @@ int _alpm_unpack(const char *archive, const char *prefix, alpm_list_t *list, int
cleanup:
umask(oldmask);
archive_read_finish(_archive);
- if(restore_cwd) {
- chdir(cwd);
+ if(restore_cwd && chdir(cwd) != 0) {
+ _alpm_log(PM_LOG_ERROR, _("could not change directory to %s (%s)\n"), cwd, strerror(errno));
}
return(ret);
}
@@ -542,8 +542,8 @@ int _alpm_run_chroot(const char *root, const char *cmd)
}
cleanup:
- if(restore_cwd) {
- chdir(cwd);
+ if(restore_cwd && chdir(cwd) != 0) {
+ _alpm_log(PM_LOG_ERROR, _("could not change directory to %s (%s)\n"), cwd, strerror(errno));
}
return(retval);