darwinup: Correctness fix for has_suffix.
--- trunk/darwinup/Utils.cpp 2012-01-23 18:55:08 UTC (rev 997)
+++ trunk/darwinup/Utils.cpp 2012-01-23 18:55:42 UTC (rev 998)
@@ -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) {