basename() returning int?
- by EB
Probably something stupid I'm missing but, why am I getting this warning?
static void foo(char *path) {
char *bname;
char *path2 = strdup(path);
bname = basename(path2);
(line with basename() call): warning: assignment makes pointer from integer without a cast
Indeed, if I change to this, the warning goes away:
bname = (char *)basename(path2);
man 3 basename tells me:
char *basename(char *path);
Both dirname() and basename() return pointers to null-terminated strings.
What gives?