[PATCH] settimeofday with NULL tv

Jeff Law law@redhat.com
Mon Dec 3 19:04:00 GMT 2012


settimeofday (NULL, tz) is used by systemd (and perhaps other code) to 
change the kernel timezone.  Unfortunately, glibc marks the first 
argument as must-be-nonnull.  This causes static analyzers to issue 
incorrect diagnostics for such uses of settimeofday.

This patch removes the __nonnull attribute and the bogus diagnostics no 
longer are issued.



-------------- next part --------------
diff --git a/ChangeLog b/ChangeLog
index 638934b..624078b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-03  Jeff Law  <law@redhat.com>
+
+	* time/sys/time.h (settimeofday): Do not mark TV argument
+	as __nonnull.
+
 2012-12-01  Mike Frysinger  <vapier@gentoo.org>
 
 	* libio/fileops.c (_IO_new_file_close_it): Do not always flush
diff --git a/time/sys/time.h b/time/sys/time.h
index 0f5ef5c..f763d96 100644
--- a/time/sys/time.h
+++ b/time/sys/time.h
@@ -77,7 +77,7 @@ extern int gettimeofday (struct timeval *__restrict __tv,
    This call is restricted to the super-user.  */
 extern int settimeofday (const struct timeval *__tv,
 			 const struct timezone *__tz)
-     __THROW __nonnull ((1));
+     __THROW;
 
 /* Adjust the current time of day by the amount in DELTA.
    If OLDDELTA is not NULL, it is filled in with the amount


More information about the Libc-alpha mailing list