[994] branches/PR-10428083/darwinup/Utils.cpp
Revision: 994 http://trac.macosforge.org/projects/darwinbuild/changeset/994 Author: mww@apple.com Date: 2012-01-20 23:07:10 -0800 (Fri, 20 Jan 2012) Log Message: ----------- Fix has_suffix. Modified Paths: -------------- branches/PR-10428083/darwinup/Utils.cpp Modified: branches/PR-10428083/darwinup/Utils.cpp =================================================================== --- branches/PR-10428083/darwinup/Utils.cpp 2012-01-21 07:06:49 UTC (rev 993) +++ branches/PR-10428083/darwinup/Utils.cpp 2012-01-21 07:07:10 UTC (rev 994) @@ -141,8 +141,11 @@ } int has_suffix(const char* str, const char* sfx) { - str = strstr(str, sfx); - return (str && strcmp(str, sfx) == 0); + const char *tmp = str + (strlen(str) - strlen(sfx)); + if (tmp > str) { + return (strcmp(tmp, sfx) == 0); + } + return false; } int exec_with_args(const char** args) {
participants (1)
-
source_changes@macosforge.org