about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-02-26 17:25:30 +0000
committerUlrich Drepper <drepper@redhat.com>2004-02-26 17:25:30 +0000
commit5db7adc49dc158294c5d4703a3d6419f18938075 (patch)
tree5315d1864d9bed6bf45ace6186feaea41c4fa749 /sysdeps
parent17568537740cb4bbeb28608a8ae6ba7a4fcf80c9 (diff)
downloadglibc-5db7adc49dc158294c5d4703a3d6419f18938075.tar.gz
glibc-5db7adc49dc158294c5d4703a3d6419f18938075.tar.xz
glibc-5db7adc49dc158294c5d4703a3d6419f18938075.zip
Update.
2004-02-26  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Use the official
	not cancelable interfaces.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/sysconf.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c
index 94cba88e90..fff3868805 100644
--- a/sysdeps/unix/sysv/linux/sysconf.c
+++ b/sysdeps/unix/sysv/linux/sysconf.c
@@ -21,6 +21,7 @@
 #include <sysdep.h>
 #include <time.h>
 #include <unistd.h>
+#include <not-cancel.h>
 
 static long int posix_sysconf (int name);
 
@@ -51,30 +52,27 @@ __sysconf (int name)
       {
 	/* Try to read the information from the /proc/sys/kernel/ngroups_max
 	   file.  */
-	int fd = __open_nocancel ("/proc/sys/kernel/ngroups_max", O_RDONLY);
+	int fd = open_not_cancel_2 ("/proc/sys/kernel/ngroups_max", O_RDONLY);
 	if (fd != -1)
 	  {
 	    /* This is more than enough, the file contains a single
 	       integer.  */
 	    char buf[32];
-	    long int res = -1l;
+	    ssize_t n;
+	    n = TEMP_FAILURE_RETRY (read_not_cancel (fd, buf,
+						     sizeof (buf) - 1));
+	    close_not_cancel_no_status (fd);
 
-	    ssize_t n = __read_nocancel (fd, buf, sizeof (buf) - 1);
 	    if (n > 0)
 	      {
 		/* Terminate the string.  */
 		buf[n] = '\0';
 
 		char *endp;
-		res = strtol (buf, &endp, 10);
-		if (endp == buf || (*endp != '\0' && *endp != '\n'))
-		  res = -1l;
+		long int res = strtol (buf, &endp, 10);
+		if (endp != buf && (*endp == '\0' || *endp == '\n'))
+		  return res;
 	      }
-
-	    __close_nocancel (fd);
-
-	    if (res != -1)
-	      return res;
 	  }
       }
       break;