diff options
author | Jim Meyering <jim@meyering.net> | 2003-07-12 16:07:30 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-07-12 16:07:30 +0000 |
commit | 959a2409fe2684f971ce5cf92efb02888e948c24 (patch) | |
tree | ca1b2355db4b5669307e6a0fc6332e02c6479a92 | |
parent | 6599007a625e667a8e164ee3bc0f36d7b837c374 (diff) | |
download | coreutils-959a2409fe2684f971ce5cf92efb02888e948c24.tar.xz |
Don't emit diagnostics. Let callers do that.
Don't include "error.h".
(save_cwd): Don't call error. Ensure that errno is valid
when returning nonzero.
-rw-r--r-- | lib/save-cwd.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/save-cwd.c b/lib/save-cwd.c index bd75ef745..068ff0ac0 100644 --- a/lib/save-cwd.c +++ b/lib/save-cwd.c @@ -47,7 +47,6 @@ extern int errno; #endif #include "save-cwd.h" -#include "error.h" #include "xgetcwd.h" /* Record the location of the current working directory in CWD so that @@ -80,10 +79,7 @@ save_cwd (struct saved_cwd *cwd) #if HAVE_FCHDIR cwd->desc = open (".", O_RDONLY | O_DIRECTORY); if (cwd->desc < 0) - { - error (0, errno, "cannot open current directory"); - return 1; - } + return 1; # if __sun__ || sun /* On SunOS 4 and IRIX 5.3, fchdir returns EINVAL when auditing @@ -98,9 +94,10 @@ save_cwd (struct saved_cwd *cwd) } else { - error (0, errno, "current directory"); + int saved_errno = errno; close (cwd->desc); cwd->desc = -1; + errno = saved_errno; return 1; } } @@ -115,10 +112,7 @@ save_cwd (struct saved_cwd *cwd) { cwd->name = xgetcwd (); if (cwd->name == NULL) - { - error (0, errno, "cannot get current directory"); - return 1; - } + return 1; } return 0; } |