mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-13 15:26:48 +02:00
(save_cwd) [!HAVE_FCHDIR]: Avoid a core dump via abort() which occurred
because cwd->desc was uninitialed. (restore_cwd) [!HAVE_FCHDIR]: Remove unnecessary redefinition of fchdir. Both from Bruno Haible.
This commit is contained in:
6
src/du.c
6
src/du.c
@@ -225,6 +225,7 @@ save_cwd (cwd)
|
||||
|
||||
if (!have_working_fchdir)
|
||||
{
|
||||
cwd->desc = -1;
|
||||
cwd->name = xgetcwd ();
|
||||
if (cwd->name == NULL)
|
||||
error (1, errno, "cannot get current directory");
|
||||
@@ -241,11 +242,6 @@ restore_cwd (cwd, dest, current)
|
||||
const char *dest;
|
||||
const char *current;
|
||||
{
|
||||
|
||||
#ifndef HAVE_FCHDIR
|
||||
#define fchdir(x) (abort (), -1)
|
||||
#endif
|
||||
|
||||
if (cwd->desc >= 0)
|
||||
{
|
||||
if (fchdir (cwd->desc) < 0)
|
||||
|
||||
Reference in New Issue
Block a user