@pmatilai commented on this pull request.


> @@ -78,16 +84,81 @@ static char *doUncompress(const char *fn)
     return cmd;
 }
 
+/**
+ * Detect if an archive has a single top level entry, and it's a directory.
+ *
+ * @param path path of the archive
+ * @return     1 if archive as only a directory as top level entry,
+ *             0 if it contains multiple top level entries or a single file
+ *             -1 on archive error
+ */
+static int singleRoot(const char *path)
+{
+       struct archive *a;
+       struct archive_entry *entry;
+       int r, ret, rootLen;

Initialize ret to -1 for errors so you only need to change it on the success 
case in the following code. Saves several redundant assignments and makes the 
logic easier to follow. Assume failure is a very common idiom, including but 
not limited to rpm.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2859#pullrequestreview-1836290250
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/2859/review/1836290...@github.com>
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to