1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-07 06:43:00 +03:00
2004-02-26  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Use the official
	not cancelable interfaces.
This commit is contained in:
Ulrich Drepper
2004-02-26 17:25:30 +00:00
parent 1756853774
commit 5db7adc49d
2 changed files with 14 additions and 11 deletions

View File

@@ -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> 2004-02-24 Arnold D. Robbins <arnold@skeeve.com>
* posix/regex_internal.c (build_wcs_upper_buffer): Enclose * posix/regex_internal.c (build_wcs_upper_buffer): Enclose

View File

@@ -21,6 +21,7 @@
#include <sysdep.h> #include <sysdep.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <not-cancel.h>
static long int posix_sysconf (int name); 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 /* Try to read the information from the /proc/sys/kernel/ngroups_max
file. */ 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) if (fd != -1)
{ {
/* This is more than enough, the file contains a single /* This is more than enough, the file contains a single
integer. */ integer. */
char buf[32]; 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) if (n > 0)
{ {
/* Terminate the string. */ /* Terminate the string. */
buf[n] = '\0'; buf[n] = '\0';
char *endp; char *endp;
res = strtol (buf, &endp, 10); long int res = strtol (buf, &endp, 10);
if (endp == buf || (*endp != '\0' && *endp != '\n')) if (endp != buf && (*endp == '\0' || *endp == '\n'))
res = -1l; return res;
} }
__close_nocancel (fd);
if (res != -1)
return res;
} }
} }
break; break;