summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2000-06-07 05:43:37 +0000
committerPaul Smith <psmith@gnu.org>2000-06-07 05:43:37 +0000
commit4a5550c8225d762f684d4047e20cc45274b6a785 (patch)
tree943515aca19373ad0fe0dce0cb852c2eca7b0cab /dir.c
parente5c40f6e5ad9d485f7caada51e2361758baa67dd (diff)
downloadgunmake-4a5550c8225d762f684d4047e20cc45274b6a785.tar.gz
* Lots of bug fixes and cleanup; new i18n files, etc.
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/dir.c b/dir.c
index 9221c44..d783c64 100644
--- a/dir.c
+++ b/dir.c
@@ -296,6 +296,7 @@ find_directory (name)
register unsigned int hash = 0;
register char *p;
register struct directory *dir;
+ int r;
#ifdef WINDOWS32
char* w32_path;
char fs_label[BUFSIZ];
@@ -333,19 +334,28 @@ find_directory (name)
/* The directory is not in the name hash table.
Find its device and inode numbers, and look it up by them. */
-#ifdef VMS
- if (vmsstat_dir (name, &st) < 0)
-#else
-
-# ifdef WINDOWS32
+#ifdef WINDOWS32
/* Remove any trailing '\'. Windows32 stat fails even on valid
directories if they end in '\'. */
if (p[-1] == '\\')
p[-1] = '\0';
-# endif
- if (stat (name, &st) < 0)
#endif
- {
+
+#ifdef VMS
+ r = vmsstat_dir (name, &st);
+#else
+ r = stat (name, &st);
+#endif
+
+#ifdef WINDOWS32
+ /* Put back the trailing '\'. If we don't, we're permanently
+ truncating the value! */
+ if (p[-1] == '\0')
+ p[-1] = '\\';
+#endif
+
+ if (r < 0)
+ {
/* Couldn't stat the directory. Mark this by
setting the `contents' member to a nil pointer. */
dir->contents = 0;