pkgsrc/archivers/ha/patches/patch-ac
asau 6b6c865608 Fix segmentation fault due to time_t being longer than long.
While here, allow building it with standard make.
2013-09-18 20:58:35 +00:00

25 lines
836 B
Text

$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;