summary refs log tree commit diff
path: root/sysdeps/mach
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach')
-rw-r--r--sysdeps/mach/hurd/getcwd.c16
-rw-r--r--sysdeps/mach/hurd/setpgid.c3
2 files changed, 13 insertions, 6 deletions
diff --git a/sysdeps/mach/hurd/getcwd.c b/sysdeps/mach/hurd/getcwd.c
index b42e0979a6..abec22c12c 100644
--- a/sysdeps/mach/hurd/getcwd.c
+++ b/sysdeps/mach/hurd/getcwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -57,7 +57,7 @@ __getcwd (char *buf, size_t size)
 			 (vm_address_t) dirbuf, dirbufsize);
     }
 
-      
+
   if (size == 0)
     {
       if (buf != NULL)
@@ -139,7 +139,7 @@ __getcwd (char *buf, size_t size)
       dirdatasize = dirbufsize;
       while (!(err = __dir_readdir (parent, &dirdata, &dirdatasize,
 				    direntry, -1, 0, &nentries)) &&
-	     nentries != 0)	     
+	     nentries != 0)
 	{
 	  /* We have a block of directory entries.  */
 
@@ -167,7 +167,7 @@ __getcwd (char *buf, size_t size)
 	      d = (struct dirent *) &dirdata[offset];
 	      offset += d->d_reclen;
 
-	      /* Ignore `.' and `..'.  */	
+	      /* Ignore `.' and `..'.  */
 	      if (d->d_name[0] == '.' &&
 		  (d->d_namlen == 1 ||
 		   (d->d_namlen == 2 && d->d_name[1] == '.')))
@@ -191,6 +191,14 @@ __getcwd (char *buf, size_t size)
 
       if (err)
 	goto errlose;
+      else if (nentries == 0)
+	{
+	  /* We got to the end of the directory without finding anything!
+	     We are in a directory that has been unlinked, or something is
+	     broken.  */
+	  err = ENOENT;
+	  goto errlose;
+	}
       else
 	{
 	  /* Prepend the directory name just discovered.  */
diff --git a/sysdeps/mach/hurd/setpgid.c b/sysdeps/mach/hurd/setpgid.c
index 7c74ef8a4c..cda54e127a 100644
--- a/sysdeps/mach/hurd/setpgid.c
+++ b/sysdeps/mach/hurd/setpgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -54,4 +54,3 @@ DEFUN(__setpgid, (pid, pgid), pid_t pid AND pid_t pgid)
 }
 
 weak_alias (__setpgid, setpgid)
-weak_alias (__setpgid, setpgrp)