summaryrefslogtreecommitdiff
path: root/mkfs.ubifs/mkfs.ubifs.c
diff options
context:
space:
mode:
Diffstat (limited to 'mkfs.ubifs/mkfs.ubifs.c')
-rw-r--r--mkfs.ubifs/mkfs.ubifs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c
index 6c4e912..bedf8a7 100644
--- a/mkfs.ubifs/mkfs.ubifs.c
+++ b/mkfs.ubifs/mkfs.ubifs.c
@@ -248,7 +248,8 @@ static int do_openat(int fd, const char *path, int flags)
ret = fchdir(fd);
if (ret != -1)
ret = open(path, flags);
- chdir(cwd);
+ if (chdir(cwd) && !ret)
+ ret = -1;
free(cwd);
return ret;
}
@@ -539,7 +540,7 @@ static int get_options(int argc, char**argv)
break;
case 'h':
case '?':
- printf(helptext);
+ printf("%s", helptext);
exit(0);
case 'v':
verbose = 1;