Gnu tar sometimes prints a "tar: Record size = 16" message, breaking
authorMichael Schroeder <mls@suse.de>
Mon, 12 Apr 2010 10:12:46 +0000 (12:12 +0200)
committerFlorian Festi <ffesti@redhat.com>
Mon, 12 Apr 2010 10:12:46 +0000 (12:12 +0200)
rpmbuild -ta.

build.c

diff --git a/build.c b/build.c
index 05bafee..501f9d6 100644 (file)
--- a/build.c
+++ b/build.c
@@ -128,7 +128,13 @@ static char * getTarSpec(const char *arg)
        if (!(fp = popen(cmd, "r"))) {
            rpmlog(RPMLOG_ERR, _("Failed to open tar pipe: %m\n"));
        } else {
-           char *fok = fgets(tarbuf, sizeof(tarbuf) - 1, fp);
+           char *fok;
+           for (;;) {
+               fok = fgets(tarbuf, sizeof(tarbuf) - 1, fp);
+               /* tar sometimes prints "tar: Record size = 16" messages */
+               if (!fok || strncmp(fok, "tar: ", 5) != 0)
+                   break;
+           }
            pclose(fp);
            gotspec = (fok != NULL) && isSpecFile(tmpSpecFile);
        }