File installnoglob.diff of Package rpm.2971

--- ./lib/rpminstall.c.orig	2013-11-22 10:31:31.000000000 +0000
+++ ./lib/rpminstall.c	2015-01-08 15:08:51.915252699 +0000
@@ -385,6 +385,19 @@ static int checkFreshenStatus(rpmts ts,
     return (oldH != NULL);
 }
 
+static int rpmNoGlob(const char *fn, int *argcPtr, ARGV_t * argvPtr)
+{
+    struct stat sb;
+    int rc = stat(fn, &sb);
+    if (rc == 0) {
+	argvAdd(argvPtr, fn);
+	*argcPtr = 1;
+    } else {
+	*argcPtr = 0;
+    }
+    return rc;
+}
+
 /** @todo Generalize --freshen policies. */
 int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv)
 {
@@ -417,13 +430,20 @@ int rpmInstall(rpmts ts, struct rpmInsta
     for (eiu->fnp = fileArgv; *eiu->fnp != NULL; eiu->fnp++) {
     	ARGV_t av = NULL;
     	int ac = 0;
-	char * fn;
 
-	fn = rpmEscapeSpaces(*eiu->fnp);
-	rc = rpmGlob(fn, &ac, &av);
-	fn = _free(fn);
+	if (giFlags & RPMGI_NOGLOB) {
+	    rc = rpmNoGlob(*eiu->fnp, &ac, &av);
+	} else {
+	    char * fn = rpmEscapeSpaces(*eiu->fnp);
+	    rc = rpmGlob(fn, &ac, &av);
+	    fn = _free(fn);
+	}
 	if (rc || ac == 0) {
-	    rpmlog(RPMLOG_ERR, _("File not found by glob: %s\n"), *eiu->fnp);
+	    if (giFlags & RPMGI_NOGLOB) {
+		rpmlog(RPMLOG_ERR, _("File not found: %s\n"), *eiu->fnp);
+	    } else {
+		rpmlog(RPMLOG_ERR, _("File not found by glob: %s\n"), *eiu->fnp);
+	    }
 	    eiu->numFailed++;
 	    continue;
 	}
openSUSE Build Service is sponsored by