$NetBSD: patch-ao,v 1.2 2009/04/25 23:46:47 gdt Exp $ --- zoopack.c.orig 1993-05-01 05:59:21.000000000 +0200 +++ zoopack.c @@ -32,7 +32,9 @@ Copyright (C) 1986, 1987 Rahul Dhesi -- #include #endif +#ifdef USE_MKTEMP char *mktemp PARMS((char *)); +#endif struct zoo_header zoo_header = { TEXT, @@ -76,6 +78,7 @@ int bad_header = 0; int latest_date = 0; /* latest date on any file moved */ int latest_time = 0; /* ...likewise */ int curr_dir = 0; /* create backup in curr dir */ +static int fd; static char partial_msg[] = "Partially packed archive left in %s.\n"; @@ -171,9 +174,16 @@ if (!curr_dir) { } else { strcpy (temp_file, xes); } +#ifdef USE_MKTEMP +fd = 0; mktemp (temp_file); /* ... and make unique */ new_file = zoocreate (temp_file); -if (new_file == NOFILE) +#else +fd = mkstemp (temp_file); +if (fd >= 0) + new_file = zoocreate (temp_file); +#endif +if (fd < 0 || new_file == NOFILE) prterror ('f', "Could not create temporary file %s.\n", temp_file); /*