fix const-correctness of argument to stime
authorRich Felker <dalias@aerifal.cx>
Tue, 7 Jan 2014 08:02:14 +0000 (03:02 -0500)
committerRich Felker <dalias@aerifal.cx>
Tue, 7 Jan 2014 08:02:14 +0000 (03:02 -0500)
it's unclear what the historical signature for this function was, but
semantically, the argument should be a pointer to const, and this is
what glibc uses. correct programs should not be using this function
anyway, so it's unlikely to matter.

include/time.h
src/linux/stime.c

index 705740933a6eaf4ee1f4e8b7f3d3f5abc0ce9d14..dc8807063af91c19f655e26d00d5360e14305df9 100644 (file)
@@ -125,7 +125,7 @@ struct tm *getdate (const char *);
 
 
 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-int stime(time_t *);
+int stime(const time_t *);
 time_t timegm(struct tm *);
 #endif
 
index 29a1ec64a2e290ba6555fc48f2c59bb523bc7a41..7d0443ba3b668b80d0240964c784f8e78c1e6a84 100644 (file)
@@ -2,7 +2,7 @@
 #include <time.h>
 #include <sys/time.h>
 
-int stime(time_t *t)
+int stime(const time_t *t)
 {
        struct timeval tv = { .tv_sec = *t, .tv_usec = 0 };
        return settimeofday(&tv, (void *)0);