From dea9b3bc0f6ba49aec8452958f5373fbb20e7df2 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 31 Oct 2007 11:43:04 -0500 Subject: Fix basename usage in pacman and utilities basename() is a rather untrusty function call on a lot of platforms as it does some weird and different things. To solve this, I added a mbasename fuction to pacman to take its place, and simply removed its usage in the utilities (it isn't worth dealing with there). Signed-off-by: Dan McGee --- src/util/testdb.c | 4 +++- src/util/testpkg.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/util') diff --git a/src/util/testdb.c b/src/util/testdb.c index a06456a4..421a553c 100644 --- a/src/util/testdb.c +++ b/src/util/testdb.c @@ -32,6 +32,8 @@ #include #include +#define BASENAME "testdb" + int str_cmp(const void *s1, const void *s2) { return(strcmp(s1, s2)); @@ -145,7 +147,7 @@ int main(int argc, char **argv) } else if(argc == 3 && strcmp(argv[1], "-b") == 0) { dbpath = argv[2]; } else { - fprintf(stderr, "usage: %s -b \n", basename(argv[0])); + fprintf(stderr, "usage: %s -b \n", BASENAME); return(1); } diff --git a/src/util/testpkg.c b/src/util/testpkg.c index 7d844e85..d2679e58 100644 --- a/src/util/testpkg.c +++ b/src/util/testpkg.c @@ -27,6 +27,8 @@ #include +#define BASENAME "testpkg" + static void output_cb(pmloglevel_t level, char *fmt, va_list args) { if(strlen(fmt)) { @@ -45,7 +47,7 @@ int main(int argc, char **argv) pmpkg_t *pkg = NULL; if(argc != 2) { - fprintf(stderr, "usage: %s \n", basename(argv[0])); + fprintf(stderr, "usage: %s \n", BASENAME); return(1); } -- cgit v1.2.3-70-g09d2