Another patch that went through the cracks.

This commit is contained in:
espie 2001-03-14 00:17:32 +00:00
parent 3ece407749
commit 8a5d714989

View File

@ -1,28 +1,26 @@
--- kdesu/kdesu_stub.c.orig Tue Sep 12 11:14:17 2000
+++ kdesu/kdesu_stub.c Sun Nov 26 16:53:02 2000
@@ -276,9 +276,17 @@ int main()
$OpenBSD: patch-kdesu_stub_c,v 1.3 2001/03/14 00:17:32 espie Exp $
--- kdesu/kdesu_stub.c.orig Sat Mar 10 15:22:48 2001
+++ kdesu/kdesu_stub.c Sat Mar 10 15:48:03 2001
@@ -276,9 +276,11 @@ int main()
xsetenv("DISPLAY", params[P_DISPLAY].value);
if (params[P_DISPLAY_AUTH].value[0])
{
+#ifdef HAVE_MKSTEMP
- fname = tmpnam(0L);
- fout = fopen(fname, "w");
- if (!fout)
+ int fd;
+ strcpy(fname, "/tmp/kdesu.XXXXXXXXXX");
+
+ fd = mkstemp(fname);
+ if (fd == -1 || (fout = fdopen(fd, "w")) == NULL)
+#else
fname = tmpnam(0L);
fout = fopen(fname, "w");
if (!fout)
+#endif
{
perror("kdesu_stub: fopen()");
exit(1);
@@ -286,7 +294,23 @@ int main()
@@ -286,7 +288,19 @@ int main()
fprintf(fout, "add %s %s\n", params[P_DISPLAY].value,
params[P_DISPLAY_AUTH].value);
fclose(fout);
+#ifdef HAVE_MKSTEMP
- tmpnam(xauthority);
+ strcpy(xauthority, "/tmp/xauth.XXXXXXXXXX");
+ {
+ int fd;
@ -36,35 +34,29 @@
+ else
+ close(fd);
+ }
+#else
tmpnam(xauthority);
+#endif
xsetenv("XAUTHORITY", xauthority);
sprintf(command, "xauth source %s >/dev/null 2>&1", fname);
if (system(command))
@@ -305,9 +329,17 @@ int main()
@@ -305,9 +319,11 @@ int main()
auth = xstrsep(params[P_ICE_AUTH].value);
if (host[0])
{
+#ifdef HAVE_MKSTEMP
- fname = tmpnam(0L);
- fout = fopen(fname, "w");
- if (!fout)
+ int fd;
+ strcpy(fname, "/tmp/kdesu.XXXXXXXXXX");
+
+ fd = mkstemp(fname);
+ if (fd == -1 || (fout = fdopen(fd, "w")) == NULL)
+#else
fname = tmpnam(0L);
fout = fopen(fname, "w");
if (!fout)
+#endif
{
perror("kdesu_stub: fopen()");
exit(1);
@@ -318,7 +350,23 @@ int main()
@@ -318,7 +334,19 @@ int main()
for (i=0; host[i]; i++)
fprintf(fout, "add DCOP \"\" %s %s\n", host[i], auth[i]);
fclose(fout);
+#ifdef HAVE_MKSTEMP
- tmpnam(iceauthority);
+ strcpy(iceauthority, "/tmp/iceauth.XXXXXXXXXX");
+ {
+ int fd;
@ -78,9 +70,6 @@
+ else
+ close(fd);
+ }
+#else
tmpnam(iceauthority);
+#endif
xsetenv("ICEAUTHORITY", iceauthority);
sprintf(command, "iceauth source %s >/dev/null 2>&1", fname);
if (system(command))