1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-24 04:33:24 +00:00
freebsd-ports/comms/zmtx-zmrx/files/patch-zmrx.c
Alexey Dokuchaev 14dd95e6f7 Fix double fclose() when local file exists in receive_file().
Submitted by:	Andy Xie (andy.xie.sz@gmail.com)
Approved by:	delphij (maintainer, implicit)
Feature safe:	yes
2013-04-22 07:28:11 +00:00

55 lines
1.1 KiB
C

--- ./zmrx.c.orig 1996-12-11 23:24:08.000000000 -0800
+++ ./zmrx.c 2011-07-22 17:33:19.603250928 -0700
@@ -15,6 +15,7 @@
#include <ctype.h>
#include <stdio.h>
+#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <string.h>
@@ -70,7 +71,7 @@
cps = ftell(fp) / duration;
- fprintf(stderr,"zmrx: receiving file \"%s\" %8ld bytes (%3d %%/%5d cps) \r",
+ fprintf(stderr,"receiving file \"%s\" %8ld bytes (%3d %%/%5d cps)\r",
name,ftell(fp),percentage,cps);
}
@@ -223,7 +224,7 @@
}
if (opt_v) {
- fprintf(stderr,"zmrx: receiving file \"%s\"\r",name);
+ fprintf(stderr,"receiving file \"%s\"\r",name);
}
sscanf(rx_data_subpacket + strlen(rx_data_subpacket) + 1,
@@ -243,6 +244,7 @@
fstat(fileno(fp),&s);
fclose(fp);
+ fp = NULL;
}
else {
exists = FALSE;
@@ -342,7 +344,7 @@
*/
if (opt_v) {
- fprintf(stderr,"zmrx: received file \"%s\" \n",name);
+ fprintf(stderr,"zmrx: received file \"%s\"\n",name);
}
}
@@ -386,8 +388,6 @@
printf(" -q quiet\n");
printf(" (only one of -n -c or -p may be specified)\n");
- cleanup();
-
exit(1);
}