mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
fsstress: getcwd() return value fixes
Add a check for the return value of getcwd(). Fix another check which mistakenly checks if the return value is less than zero instead of checking whether the return value is NULL. Signed-off-by: Ari Sundholm <ari@tuxera.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
+5
-1
@@ -495,7 +495,7 @@ int main(int argc, char **argv)
|
||||
|
||||
(void)mkdir(dirname, 0777);
|
||||
if (logname && logname[0] != '/') {
|
||||
if (getcwd(rpath, sizeof(rpath)) < 0){
|
||||
if (!getcwd(rpath, sizeof(rpath))){
|
||||
perror("getcwd failed");
|
||||
exit(1);
|
||||
}
|
||||
@@ -970,6 +970,10 @@ doproc(void)
|
||||
}
|
||||
top_ino = statbuf.st_ino;
|
||||
homedir = getcwd(NULL, 0);
|
||||
if (!homedir) {
|
||||
perror("getcwd failed");
|
||||
_exit(1);
|
||||
}
|
||||
seed += procid;
|
||||
srandom(seed);
|
||||
if (namerand)
|
||||
|
||||
Reference in New Issue
Block a user