Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pacman/query.c4
-rw-r--r--src/pacman/util.c18
-rw-r--r--src/pacman/util.h2
3 files changed, 8 insertions, 16 deletions
diff --git a/src/pacman/query.c b/src/pacman/query.c
index dea309a0..f5993609 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -109,8 +109,8 @@ static int query_fileowner(alpm_list_t *targets)
for(t = targets; t; t = alpm_list_next(t)) {
int found = 0;
filename = strdup(alpm_list_getdata(t));
- char *bname, *dname, *rpath;
- const char *root;
+ char *dname, *rpath;
+ const char *root, *bname;
struct stat buf;
alpm_list_t *i, *j;
diff --git a/src/pacman/util.c b/src/pacman/util.c
index d91d1d43..0377bf79 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -157,25 +157,17 @@ int rmrf(const char *path)
}
/** Parse the basename of a program from a path.
-* Grabbed from the uClibc source.
* @param path path to parse basename from
*
* @return everything following the final '/'
*/
-char *mbasename(const char *path)
+const char *mbasename(const char *path)
{
- const char *s;
- const char *p;
-
- p = s = path;
-
- while (*s) {
- if (*s++ == '/') {
- p = s;
- }
+ const char *last = strrchr(path, '/');
+ if(last) {
+ return(last + 1);
}
-
- return (char *)p;
+ return(path);
}
/** Parse the dirname of a program from a path.
diff --git a/src/pacman/util.h b/src/pacman/util.h
index a5c382df..78fe5b59 100644
--- a/src/pacman/util.h
+++ b/src/pacman/util.h
@@ -44,7 +44,7 @@ int trans_release(void);
int needs_root(void);
int getcols(void);
int rmrf(const char *path);
-char *mbasename(const char *path);
+const char *mbasename(const char *path);
char *mdirname(const char *path);
void indentprint(const char *str, int indent);
char *strtoupper(char *str);