summaryrefslogtreecommitdiff
path: root/net/cap/files/patch-applications-lwsrv-lwsrv.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/cap/files/patch-applications-lwsrv-lwsrv.c')
-rw-r--r--net/cap/files/patch-applications-lwsrv-lwsrv.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/net/cap/files/patch-applications-lwsrv-lwsrv.c b/net/cap/files/patch-applications-lwsrv-lwsrv.c
new file mode 100644
index 000000000000..86ef32146da6
--- /dev/null
+++ b/net/cap/files/patch-applications-lwsrv-lwsrv.c
@@ -0,0 +1,54 @@
+--- applications/lwsrv/lwsrv.c.orig Sat Mar 20 14:38:45 2004
++++ applications/lwsrv/lwsrv.c Sat Mar 20 14:55:51 2004
+@@ -1864,7 +1864,7 @@
+ PFILE *pf;
+ {
+ long t;
+- int argc, i;
++ int argc, i, fd;
+ FILE *outfile;
+ char tname[256],status[256];
+ char pbuf[256],rhbuf[16],jbuf[1024];
+@@ -1930,10 +1930,8 @@
+ strcat(tname,"/lwsrvXXXXXX");
+ } else
+ strcpy(tname,TEMPFILE);
+- mktemp(tname);
+- if ((outfile = fopen(tname, "w+")) == NULL)
++ if ( ((fd = mkstemp(tname)) == -1 ) || ((outfile = fdopen(fd, "w+")) == NULL) )
+ perror(tname);
+- chmod(tname, 0600);
+ }
+
+ NewStatus(prtp->children <= 0 ? "initializing" : statusprocessing);
+@@ -2310,7 +2308,7 @@
+ PFILE *pf;
+ {
+ long t;
+- int argc, i;
++ int argc, i, fd;
+ FILE *outfile;
+ char tname[256],status[256];
+ char pbuf[256],rhbuf[16],jbuf[1024];
+@@ -2354,16 +2352,15 @@
+ if (tmpfiledir != NULL) {
+ strcpy(tname,tmpfiledir);
+ strcat(tname,"/lwsrvXXXXXX");
++ if ((outfile = fopen(tname, "w+")) == NULL)
++ perror(tname);
++ chmod(tname, 0600);
+ } else
+ strcat(tname,TEMPFILE);
+- mktemp(tname);
++ if ( ((fd = mkstemp(tname)) == -1 ) || ((outfile = fdopen(fd, "w+")) == NULL) )
++ perror(tname);
+ }
+
+- if ((outfile = fopen(tname, "w+")) == NULL)
+- perror(tname);
+-
+- chmod(tname, 0600);
+-
+ if (singlefork)
+ NewStatus("initializing");
+