projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Mention that the 'free' module, LIA-1.
[gnulib.git]
/
lib
/
save-cwd.c
diff --git
a/lib/save-cwd.c
b/lib/save-cwd.c
index
b7b85a1
..
17d077d
100644
(file)
--- a/
lib/save-cwd.c
+++ b/
lib/save-cwd.c
@@
-1,5
+1,5
@@
/* save-cwd.c -- Save and restore current working directory.
/* save-cwd.c -- Save and restore current working directory.
- Copyright (C) 1995, 1997, 1998, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1997, 1998, 2003
, 2004
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-22,10
+22,7
@@
#endif
#include <stdio.h>
#endif
#include <stdio.h>
-
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-#endif
+#include <stdlib.h>
#if HAVE_UNISTD_H
# include <unistd.h>
#if HAVE_UNISTD_H
# include <unistd.h>
@@
-79,7
+76,12
@@
save_cwd (struct saved_cwd *cwd)
#if HAVE_FCHDIR
cwd->desc = open (".", O_RDONLY | O_DIRECTORY);
if (cwd->desc < 0)
#if HAVE_FCHDIR
cwd->desc = open (".", O_RDONLY | O_DIRECTORY);
if (cwd->desc < 0)
- return 1;
+ cwd->desc = open (".", O_WRONLY | O_DIRECTORY);
+ if (cwd->desc < 0)
+ {
+ cwd->name = xgetcwd ();
+ return cwd->name == NULL;
+ }
# if __sun__ || sun
/* On SunOS 4 and IRIX 5.3, fchdir returns EINVAL when auditing
# if __sun__ || sun
/* On SunOS 4 and IRIX 5.3, fchdir returns EINVAL when auditing