[Rpm-maint] [rpm-software-management/rpm] add build directory auto path to %autosetup step (PR #2859)
Panu Matilainen
notifications at github.com
Mon Jan 22 11:52:28 UTC 2024
@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/1836290250 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240122/87e52ee1/attachment.html>
More information about the Rpm-maint
mailing list