Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/patch Do not try to write a rejects file for those c...



details:   https://anonhg.NetBSD.org/src/rev/d94e4ff65210
branches:  trunk
changeset: 541841:d94e4ff65210
user:      kristerw <kristerw%NetBSD.org@localhost>
date:      Sun Jan 19 00:50:28 2003 +0000

description:
Do not try to write a rejects file for those cases where the user has
told us to skip a patch due to missing file to patch.

Solves PR 19827 from Toru TAKAMIZU.

diffstat:

 usr.bin/patch/patch.c |  37 ++++++++++++++++++++-----------------
 1 files changed, 20 insertions(+), 17 deletions(-)

diffs (65 lines):

diff -r 8685e11834c4 -r d94e4ff65210 usr.bin/patch/patch.c
--- a/usr.bin/patch/patch.c     Sun Jan 19 00:42:45 2003 +0000
+++ b/usr.bin/patch/patch.c     Sun Jan 19 00:50:28 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: patch.c,v 1.12 2002/03/16 22:36:42 kristerw Exp $      */
+/*     $NetBSD: patch.c,v 1.13 2003/01/19 00:50:28 kristerw Exp $      */
 
 /* patch - a program to apply diffs to original files
  *
@@ -25,7 +25,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: patch.c,v 1.12 2002/03/16 22:36:42 kristerw Exp $");
+__RCSID("$NetBSD: patch.c,v 1.13 2003/01/19 00:50:28 kristerw Exp $");
 #endif /* not lint */
 
 #include "INTERN.h"
@@ -152,7 +152,7 @@
        reinitialize_almost_everything()
     ) {                                        /* for each patch in patch file */
 
-       if (outname == NULL)
+       if (!skip_rest_of_patch && outname == NULL)
            outname = xstrdup(filearg[0]);
     
        /* for ed script just up and do it and exit */
@@ -314,20 +314,23 @@
        rejfp = NULL;
        if (failed) {
            failtotal += failed;
-           if (!*rejname) {
-               Strcpy(rejname, outname);
-               Strcat(rejname, REJEXT);
-           }
-           if (skip_rest_of_patch) {
-               say("%d out of %d hunks ignored--saving rejects to %s\n",
-                   failed, hunk, rejname);
-           }
-           else {
-               say("%d out of %d hunks failed--saving rejects to %s\n",
-                   failed, hunk, rejname);
-           }
-           if (move_file(TMPREJNAME, rejname) < 0)
-               trejkeep = TRUE;
+           if (outname != NULL) {
+                   if (!*rejname) {
+                           Strcpy(rejname, outname);
+                           Strcat(rejname, REJEXT);
+                   }
+                   if (skip_rest_of_patch)
+                           say("%d out of %d hunks ignored"
+                               "--saving rejects to %s\n",
+                               failed, hunk, rejname);
+                   else
+                           say("%d out of %d hunks failed"
+                               "--saving rejects to %s\n",
+                               failed, hunk, rejname);
+                   if (move_file(TMPREJNAME, rejname) < 0)
+                           trejkeep = TRUE;
+           } else
+                   say("%d out of %d hunks ignored\n", failed, hunk);
        }
        set_signals(1);
     }



Home | Main Index | Thread Index | Old Index