shithub: scc

Download patch

ref: 8bc7d1659de95ce7d93c588821ff2f038918fb01
parent: 0b30fc3454b5d07513cb66ddc7c1f57768a341ed
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Feb 19 10:12:28 EST 2018

[ar] Enable early close for -q

If we don't have parameters is a good idea to do nothing.

--- a/ar/main.c
+++ b/ar/main.c
@@ -518,7 +518,8 @@
 {
 	FILE *tmp1, *tmp2;
 
-	if (*flist == NULL && (key == 'r' || key == 'd' || key == 'm')) {
+	if (*flist == NULL &&
+	    (key == 'r' || key == 'd' || key == 'm' || key == 'q')) {
 		if (fclose(fp) == EOF) {
 			perror("ar:early close of archive file");
 			exit(-1);
--- a/tests/ar/execute/00-test-q.sh
+++ b/tests/ar/execute/00-test-q.sh
@@ -4,12 +4,7 @@
 
 set -e
 
-TZ=UTC
-tmp1=`mktemp`
-tmp2=`mktemp`
-pwd=$PWD
-
-trap "rm -f $tmp1 $tmp2 file.a;\
+trap "rm -f file.a;\
       rm -f *.tst" 0 2 3
 
 ###########################################################################