$NetBSD: patch-aa,v 1.2 2012/07/24 17:17:30 mishka Exp $ Make C compiler happy. N.B.: should be submitted to ache@. --- todos.c.orig 2003-01-02 20:17:18.000000000 +0000 +++ todos.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #if defined(__MSDOS__) || defined(__OS2__) @@ -98,6 +99,7 @@ char *outdir = ""; main(int ac, char **av) { char *name, *tmpn, *srcn, *s, *incode, *outcode; + int tmpfd; FILE *fin, *fout; struct stat statb; int got_stat = FALSE; @@ -258,10 +260,11 @@ usage: } sprintf(tmp_name, "%s%s%s", outdir, *outdir ? "/" : "", tmp_pat); - if ((tmpn = mktemp(tmp_name)) == NULL) { + if ((tmpfd = mkstemp(tmp_name)) < 0) { perror(tmp_name); return 1; } + strcpy(tmpn, tmp_name); while (ac-- > 1) { srcn = av[1]; @@ -274,7 +277,7 @@ usage: perror(srcn); goto usage; } - if ((fout = fopen(tmpn, WB)) == NULL) { + if ((fout = fdopen(tmpfd, WB)) == NULL) { perror(tmpn); return 1; } @@ -302,11 +305,11 @@ usage: return 1; } if (got_stat) { - long ut[2]; + struct utimbuf ut; - ut[0] = statb.st_atime; - ut[1] = statb.st_mtime; - utime(srcn, ut); + ut.actime = statb.st_atime; + ut.modtime = statb.st_mtime; + utime(srcn, &ut); } if (verbose) fprintf(stderr, "Done.\n");