[PATCH] Fix sysconf (_SC_MONOTONIC_CLOCK)

Jakub Jelinek jakub@redhat.com
Thu Mar 27 16:51:00 GMT 2003


Hi!

sysconf (_SC_MONOTONIC_CLOCK) should return -1 not 0
if monotonic clock support is not available on the system.

2003-03-27  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/sysconf.c (__sysconf) <_SC_MONOTONIC_CLOCK>:
	Return -1 instead of 0 if clock_getres failed.

--- libc/sysdeps/unix/sysv/linux/sysconf.c.jj	2003-03-22 18:32:37.000000000 -0500
+++ libc/sysdeps/unix/sysv/linux/sysconf.c	2003-03-27 08:12:20.000000000 -0500
@@ -42,7 +42,7 @@ __sysconf (int name)
 	INTERNAL_SYSCALL_DECL (err);
 	int r;
 	r = INTERNAL_SYSCALL (clock_getres, err, 2, CLOCK_MONOTONIC, &ts);
-	return INTERNAL_SYSCALL_ERROR_P (r, err) ? 0 : 1;
+	return INTERNAL_SYSCALL_ERROR_P (r, err) ? -1 : 1;
       }
 #endif
 

	Jakub



More information about the Libc-hacker mailing list