shithub: scc

Download patch

ref: 2e8217b7eced5b5af1048a3ba7144c0adb5b46c2
parent: 4d90e3d1507444cb0edb5a53ccefa3b1d958abae
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Jan 19 07:44:11 EST 2020

ar: Fix -r flag

When update flag (-u) was added the logic changed and files
were updated only when files were older and -u was passed.
It means that without -u all the files were removed from
the archive.

--- a/src/cmd/ar.c
+++ b/src/cmd/ar.c
@@ -257,10 +257,13 @@
 	char *pname;
 
 	if (pname = inlist(m->fname, argc, argv)) {
-		if (uflag && older(m, pname))
+		if (!uflag || older(m, pname)) {
 			archive(pname, tmps[m->cur].fp, 'r');
-		return;
-	} else if (posname && !strcmp(posname, m->fname)) {
+			return;
+		}
+	}
+
+	if (posname && !strcmp(posname, m->fname)) {
 		where = (bflag) ? AFTER : BEFORE;
 		m->cur = AFTER;
 	} else {