From 5db7adc49dc158294c5d4703a3d6419f18938075 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 26 Feb 2004 17:25:30 +0000 Subject: Update. 2004-02-26 Ulrich Drepper * sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Use the official not cancelable interfaces. --- ChangeLog | 5 +++++ sysdeps/unix/sysv/linux/sysconf.c | 20 +++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 98cf35fef5..18962e93a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-02-26 Ulrich Drepper + + * sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Use the official + not cancelable interfaces. + 2004-02-24 Arnold D. Robbins * 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 #include #include +#include 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; -- cgit 1.4.1