openbsd-ports/archivers/lha/patches/patch-src_lhadd_c
naddy a79394b4d5 - Add build flags missing from previous update.
- Remove again extraneous documentation that is of no interest to
  users of the compiled package.
- Prune inappropriate verbiage from description.
- Disallow CDROM distribution according to old description.
- Rename patches.
- General clean-up.
2002-02-04 22:16:17 +00:00

42 lines
1.1 KiB
Plaintext

$OpenBSD: patch-src_lhadd_c,v 1.1 2002/02/04 22:16:17 naddy Exp $
--- src/lhadd.c.orig Wed Oct 4 16:57:38 2000
+++ src/lhadd.c Mon Feb 4 17:52:03 2002
@@ -270,13 +270,35 @@ build_temporary_file()
{
int old_umask;
FILE *afp;
+ int tempfd;
+
+ #ifdef TMP_FILENAME_TEMPLATE
+ if (extract_directory == NULL) {
+ strcpy(temporary_name, TMP_FILENAME_TEMPLATE);
+ }
+ else {
+ sprintf(temporary_name, "%s/lhXXXXXX", extract_directory);
+ }
+ tempfd = mkstemp(temporary_name);
+ #else
+ char *p, *s;
+
+ strcpy(temporary_name, archive_name);
+ for (p = temporary_name, s = (char *) 0; *p; p++)
+ if (*p == '/')
+ s = p;
+ strcpy((s ? s + 1 : temporary_name), "lhXXXXXX");
+ tempfd = mkstemp(temporary_name);
+ #endif
+ if (tempfd == -1)
+ return NULL;
- build_temporary_name();
signal(SIGINT, interrupt);
signal(SIGHUP, interrupt);
old_umask = umask(077);
- afp = xfopen(temporary_name, WRITE_BINARY);
+ /*afp = xfopen(temporary_name, WRITE_BINARY);*/
+ afp = fdopen(tempfd, "w+");
remove_temporary_at_error = TRUE;
temporary_fp = afp;
umask(old_umask);