diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-02-26 17:25:30 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-02-26 17:25:30 +0000 |
commit | 5db7adc49dc158294c5d4703a3d6419f18938075 (patch) | |
tree | 5315d1864d9bed6bf45ace6186feaea41c4fa749 | |
parent | 17568537740cb4bbeb28608a8ae6ba7a4fcf80c9 (diff) | |
download | glibc-5db7adc49dc158294c5d4703a3d6419f18938075.tar glibc-5db7adc49dc158294c5d4703a3d6419f18938075.tar.gz glibc-5db7adc49dc158294c5d4703a3d6419f18938075.tar.bz2 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.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sysconf.c | 20 |
2 files changed, 14 insertions, 11 deletions
@@ -1,3 +1,8 @@ +2004-02-26 Ulrich Drepper <drepper@redhat.com> + + * sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Use the official + not cancelable interfaces. + 2004-02-24 Arnold D. Robbins <arnold@skeeve.com> * posix/regex_internal.c (build_wcs_upper_buffer): Enclose 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; |