浏览代码

fix const-correctness of argument to stime

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.
Rich Felker 11 年之前
父节点
当前提交
1d23b3c913
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      include/time.h
  2. 1 1
      src/linux/stime.c

+ 1 - 1
include/time.h

@@ -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
 

+ 1 - 1
src/linux/stime.c

@@ -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);