Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/rdist apply patches in PR bin/9249: rdist doesn't re...



details:   https://anonhg.NetBSD.org/src/rev/33b229b55d62
branches:  trunk
changeset: 487721:33b229b55d62
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Jun 12 04:43:11 2000 +0000

description:
apply patches in PR bin/9249: rdist doesn't remove temporary file, from
<Michael.Eriksson%era-t.ericsson.se@localhost> to ensure we always remove the tempfile
(broken since mkstemp() was introduced).

diffstat:

 usr.bin/rdist/docmd.c |   7 ++-----
 usr.bin/rdist/main.c  |  15 +++++++++------
 2 files changed, 11 insertions(+), 11 deletions(-)

diffs (96 lines):

diff -r e4ce2d4a865d -r 33b229b55d62 usr.bin/rdist/docmd.c
--- a/usr.bin/rdist/docmd.c     Mon Jun 12 04:27:58 2000 +0000
+++ b/usr.bin/rdist/docmd.c     Mon Jun 12 04:43:11 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: docmd.c,v 1.19 1999/04/20 07:53:02 mrg Exp $   */
+/*     $NetBSD: docmd.c,v 1.20 2000/06/12 04:43:11 mrg Exp $   */
 
 /*
  * Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)docmd.c    8.1 (Berkeley) 6/9/93";
 #else
-__RCSID("$NetBSD: docmd.c,v 1.19 1999/04/20 07:53:02 mrg Exp $");
+__RCSID("$NetBSD: docmd.c,v 1.20 2000/06/12 04:43:11 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -203,7 +203,6 @@
                if (sc->sc_type == NOTIFY)
                        notify(tempfile, rhost, sc->sc_args, 0);
        if (!nflag) {
-               (void) unlink(tempfile);
                for (; ihead != NULL; ihead = ihead->nextp) {
                        free(ihead);
                        if ((opts & IGNLNKS) || ihead->count == 0)
@@ -439,8 +438,6 @@
        for (sc = cmds; sc != NULL; sc = sc->sc_next)
                if (sc->sc_type == NOTIFY)
                        notify(tempfile, NULL, sc->sc_args, lastmod);
-       if (!nflag && !(options & VERIFY))
-               (void) unlink(tempfile);
 }
 
 /*
diff -r e4ce2d4a865d -r 33b229b55d62 usr.bin/rdist/main.c
--- a/usr.bin/rdist/main.c      Mon Jun 12 04:27:58 2000 +0000
+++ b/usr.bin/rdist/main.c      Mon Jun 12 04:43:11 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.10 1999/04/20 07:53:02 mrg Exp $    */
+/*     $NetBSD: main.c,v 1.11 2000/06/12 04:43:11 mrg Exp $    */
 
 /*
  * Copyright (c) 1983, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.1 (Berkeley) 6/9/93";
 #else
-__RCSID("$NetBSD: main.c,v 1.10 1999/04/20 07:53:02 mrg Exp $");
+__RCSID("$NetBSD: main.c,v 1.11 2000/06/12 04:43:11 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -212,6 +212,7 @@
 
        if (iamremote) {
                server();
+               unlink(tempfile);
                exit(nerrs != 0);
        }
 
@@ -219,13 +220,14 @@
                docmdargs(argc, argv);
        else {
                if (fin == NULL) {
-                       if(distfile == NULL) {
-                               if((fin = fopen("distfile","r")) == NULL)
+                       if (distfile == NULL) {
+                               if ((fin = fopen("distfile","r")) == NULL)
                                        fin = fopen("Distfile", "r");
                        } else
                                fin = fopen(distfile, "r");
-                       if(fin == NULL) {
+                       if (fin == NULL) {
                                perror(distfile ? distfile : "distfile");
+                               unlink(tempfile);
                                exit(1);
                        }
                }
@@ -234,6 +236,7 @@
                        docmds(dhosts, argc, argv);
        }
 
+       unlink(tempfile);
        exit(nerrs != 0);
 }
 
@@ -282,7 +285,7 @@
        tnl.n_name = cp;
        hosts = expand(&tnl, E_ALL);
        if (nerrs)
-               exit(1);
+               return;
 
        if (dest == NULL || *dest == '\0')
                cmds = NULL;



Home | Main Index | Thread Index | Old Index