[darwinbuild-changes] [729] branches/PR-7489777/darwinup/Depot.cpp
source_changes at macosforge.org
source_changes at macosforge.org
Tue Mar 2 08:38:03 PST 2010
Revision: 729
http://trac.macosforge.org/projects/darwinbuild/changeset/729
Author: wsiegrist at apple.com
Date: 2010-03-02 08:38:02 -0800 (Tue, 02 Mar 2010)
Log Message:
-----------
Fix archive identifier parsing so names starting with numbers do not look like serials.
Modified Paths:
--------------
branches/PR-7489777/darwinup/Depot.cpp
Modified: branches/PR-7489777/darwinup/Depot.cpp
===================================================================
--- branches/PR-7489777/darwinup/Depot.cpp 2010-03-02 16:35:11 UTC (rev 728)
+++ branches/PR-7489777/darwinup/Depot.cpp 2010-03-02 16:38:02 UTC (rev 729)
@@ -185,21 +185,30 @@
// or "oldest" for the oldest installed root)
//
Archive* Depot::get_archive(const char* arg) {
+
+ // test for arg being a uuid
uuid_t uuid;
- uint64_t serial;
if (uuid_parse(arg, uuid) == 0) {
return Depot::archive(uuid);
}
- serial = strtoull(arg, NULL, 0);
- if (serial) {
+
+ // test for arg being a serial number
+ uint64_t serial;
+ char* endptr = NULL;
+ serial = strtoull(arg, &endptr, 0);
+ if (serial && (*arg != '\0') && (*endptr == '\0')) {
return Depot::archive(serial);
}
+
+ // test for keywords
if (strncasecmp("oldest", arg, 6) == 0) {
return Depot::archive(DEPOT_ARCHIVE_OLDEST);
}
if (strncasecmp("newest", arg, 6) == 0) {
return Depot::archive(DEPOT_ARCHIVE_NEWEST);
}
+
+ // if nothing else, must be an archive name
return Depot::archive((archive_name_t)arg);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100302/7cdbb8e0/attachment.html>
More information about the darwinbuild-changes
mailing list