1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
$NetBSD: patch-ac,v 1.2 2013/09/18 20:58:36 asau Exp $
--- nix/machine.c.orig 1995-01-12 06:53:00.000000000 +0000
+++ nix/machine.c
@@ -335,8 +335,10 @@ char *md_timestring(unsigned long t) {
static char ts[22];
struct tm *tim;
+ time_t t_;
- tim=localtime((long *)&t);
+ t_ = t;
+ tim=localtime(&t_);
sprintf(ts,"%04d-%02d-%02d %02d:%02d",tim->tm_year+1900,tim->tm_mon+1,
tim->tm_mday,tim->tm_hour,tim->tm_min);
return ts;
@@ -417,7 +419,7 @@ char *md_stripname(char *mdfullpath) {
if (plainname!=NULL) free(plainname),plainname=NULL;
if ((plainname=malloc(strlen(mdfullpath)+1))==NULL)
error(1,ERR_MEM,"md_stripname()");
- for (i=strlen(mdfullpath)-1;i>0;i--) {
+ for (i=strlen(mdfullpath)-1;i>=0;i--) {
if (mdfullpath[i]=='/') {
i++;
break;
|