Jindrich Novy ff9e0e
commit c4fa73c573f63d2e2b53e75d25feafbf65ebf671
Jindrich Novy ff9e0e
Author: Jindrich Novy <jnovy@redhat.com>
Jindrich Novy ff9e0e
Date:   Wed Sep 24 18:39:43 2008 +0200
Jindrich Novy ff9e0e
Jindrich Novy ff9e0e
    Don't treat %patch numberless if -P parameter is present
Jindrich Novy ff9e0e
Jindrich Novy ff9e0e
diff --git a/build/parsePrep.c b/build/parsePrep.c
Jindrich Novy ff9e0e
index 2be0693..bfef325 100644
Jindrich Novy ff9e0e
--- a/build/parsePrep.c
Jindrich Novy ff9e0e
+++ b/build/parsePrep.c
Jindrich Novy ff9e0e
@@ -431,7 +431,10 @@ static rpmRC doPatchMacro(rpmSpec spec, const char *line)
Jindrich Novy ff9e0e
     if (! strchr(" \t\n", line[6])) {
Jindrich Novy ff9e0e
 	rasprintf(&buf, "%%patch -P %s", line + 6);
Jindrich Novy ff9e0e
     } else {
Jindrich Novy ff9e0e
-	rasprintf(&buf, "%%patch -P %d %s", INT_MAX, line + 6); /* INT_MAX denotes not numbered %patch */
Jindrich Novy ff9e0e
+	if (strstr(line+6, " -P") == NULL)
Jindrich Novy ff9e0e
+	    rasprintf(&buf, "%%patch -P %d %s", INT_MAX, line + 6); /* INT_MAX denotes not numbered %patch */
Jindrich Novy ff9e0e
+	else
Jindrich Novy ff9e0e
+	    buf = strdup(line); /* it is not numberless patch because -P is present */
Jindrich Novy ff9e0e
     }
Jindrich Novy ff9e0e
     poptParseArgvString(buf, &argc, &argv);
Jindrich Novy ff9e0e
     free(buf);