}
else
{
- strcpy(path, getenv("HOME")); strncat(path, "/tmp/", _POSIX_PATH_MAX);
+ path[5 + _POSIX_PATH_MAX] = '\0';
+ strncpy(path, getenv("HOME"), 5 + _POSIX_PATH_MAX);
+ strncat(path, "/tmp/", 5 + _POSIX_PATH_MAX);
if (stat(path, &st) < 0 && errno == ENOENT)
{
int fd;
- char warnpath[1+_POSIX_PATH_MAX];
+ char warnpath[6+_POSIX_PATH_MAX];
mkdir(path, 0700); /* ignore retvals */
- strcpy(warnpath, path);
- strncat(warnpath, ".created_by_xemacs", _POSIX_PATH_MAX);
+ warnpath[_POSIX_PATH_MAX] = '\0';
+ strncpy(warnpath, path, 5 + _POSIX_PATH_MAX);
+ strncat(warnpath, ".created_by_xemacs", 5 + _POSIX_PATH_MAX);
if ((fd = open(warnpath, O_WRONLY|O_CREAT, 0644)) > 0)
{
write(fd, "XEmacs created this directory because /tmp/<yourname> was unavailable -- \nPlease check !\n", 89);
{
time_t value;
size_t size;
+ struct tm * tm;
CHECK_STRING (format_string);
- if (! lisp_to_time (time_, &value))
+ if (! lisp_to_time (time_, &value) || ! (tm = localtime (&value)))
error ("Invalid time specification");
/* This is probably enough. */
*buf = 1;
if (emacs_strftime (buf, size,
(const char *) XSTRING_DATA (format_string),
- localtime (&value))
+ tm)
|| !*buf)
return build_ext_string (buf, Qbinary);
/* If buffer was too small, make it bigger. */
struct tm *decoded_time;
Lisp_Object list_args[9];
- if (! lisp_to_time (specified_time, &time_spec))
+ if (! lisp_to_time (specified_time, &time_spec)
+ || ! (decoded_time = localtime (&time_spec)))
error ("Invalid time specification");
- decoded_time = localtime (&time_spec);
list_args[0] = make_int (decoded_time->tm_sec);
list_args[1] = make_int (decoded_time->tm_min);
list_args[2] = make_int (decoded_time->tm_hour);
/* from GNU Emacs 21, per Simon Josefsson, modified by stephen
The slight inefficiency is justified since negative times are weird. */
Lisp_Object
-make_time (time_t time)
+make_time (time_t tval)
{
- return list2 (make_int (time < 0 ? time / 0x10000 : time >> 16),
- make_int (time & 0xFFFF));
+ return list2 (make_int (tval < 0 ? tval / 0x10000 : tval >> 16),
+ make_int (tval & 0xFFFF));
}
DEFUN ("encode-time", Fencode_time, 6, MANY, 0, /*