* src/misc.c (chdir_arg,tar_getcdpath): Check for non-NULL
return from xgetcwd. The function returns NULL for any
error originating from getcwd.
size_t copylen;
bool need_separator;
- if (!cdpath)
- call_arg_fatal ("getcwd", ".");
copylen = strlen (cdpath);
need_separator = ! (DOUBLE_SLASH_IS_DISTINCT_ROOT
&& copylen == 2 && ISSLASH (cdpath[1]));
{
wd[wd_count].name = ".";
wd[wd_count].abspath = xgetcwd ();
+ if (!wd[wd_count].abspath)
+ call_arg_fatal ("getcwd", ".");
wd[wd_count].fd = AT_FDCWD;
wd_count++;
}
{
static char *cwd;
if (!cwd)
- cwd = xgetcwd ();
+ {
+ cwd = xgetcwd ();
+ if (!cwd)
+ call_arg_fatal ("getcwd", ".");
+ }
return cwd;
}
return wd[idx].abspath;