提交 1d23b3c9 编写于 作者: R Rich Felker

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.
上级 74998fbe
...@@ -125,7 +125,7 @@ struct tm *getdate (const char *); ...@@ -125,7 +125,7 @@ struct tm *getdate (const char *);
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
int stime(time_t *); int stime(const time_t *);
time_t timegm(struct tm *); time_t timegm(struct tm *);
#endif #endif
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include <time.h> #include <time.h>
#include <sys/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 }; struct timeval tv = { .tv_sec = *t, .tv_usec = 0 };
return settimeofday(&tv, (void *)0); return settimeofday(&tv, (void *)0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册