#include <errno.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
unsigned sleep(unsigned seconds)
{
ts.tv_sec = seconds;
ts.tv_nsec = 0;
if (!nanosleep(&ts,&ts)) return 0;
- if (errno == EINTR) return ts.tv_sec;
+ if (errno == EINTR) return ts.tv_sec & UINT_MAX;
return -1;
}
ts.tv_sec = (long int)useconds / 1000000;
ts.tv_nsec = ((long int)useconds % 1000000) * 1000;
if (!nanosleep(&ts,&ts)) return 0;
- if (errno == EINTR) return ts.tv_sec;
return -1;
}
f._read = __seofread;
f._ub._base = NULL;
f._lb._base = NULL;
+ f._flags2 = 0;
+ f._ur = 0;
f._file = -1; /* No file. */
va_start (ap, fmt);
ret = __ssvfwscanf_r (_REENT, &f, fmt, ap);
f._read = __seofread;
f._ub._base = NULL;
f._lb._base = NULL;
+ f._flags2 = 0;
+ f._ur = 0;
f._file = -1; /* No file. */
return __ssvfwscanf_r (ptr, &f, fmt, ap);
}
{
u_char rnd[KEYSZ + IVSZ];
+ memset(rnd, 0, (KEYSZ + IVSZ) * sizeof(u_char));
+
if (getentropy(rnd, sizeof rnd) == -1)
_getentropy_fail();
{
struct timeval now;
+ now.tv_sec = (time_t) -1;
+
if (_gettimeofday_r (_REENT, &now, NULL) < 0)
now.tv_sec = (time_t) -1;