return EXIT_FAILURE;
}
cwd = xgetcwd(cwd);
-
+ if (!cwd)
+ cwd = unknown;
return EXIT_SUCCESS;
}
/* built-in 'pwd' handler */
static int builtin_pwd(struct child_prog *dummy)
{
+ cwd = xgetcwd(cwd);
+ if (!cwd)
+ cwd = unknown;
printf( "%s\n", cwd);
return EXIT_SUCCESS;
}
{
if (cwd) {
free(cwd);
- cwd = NULL;
}
if (local_pending_command)
free(local_pending_command);
/* initialize the cwd -- this is never freed...*/
cwd = xgetcwd(0);
+ if (!cwd)
+ cwd = unknown;
#ifdef BB_FEATURE_CLEAN_UP
atexit(free_memory);