Browse Source

If you call makepath() with an absolute name it returns a copy of it

master
lostd 10 years ago
parent
commit
4b1b156a3b
1 changed files with 10 additions and 5 deletions
  1. +10
    -5
      noice.c

+ 10
- 5
noice.c View File

@@ -490,11 +490,16 @@ makepath(char *dir, char *name)
{
char *path;

/* Handle root case */
if (strcmp(dir, "/") == 0)
asprintf(&path, "/%s", name);
else
asprintf(&path, "%s/%s", dir, name);
/* Handle absolute path */
if (name[0] == '/') {
path = xstrdup(name);
} else {
/* Handle root case */
if (strcmp(dir, "/") == 0)
asprintf(&path, "/%s", name);
else
asprintf(&path, "%s/%s", dir, name);
}

return path;
}


Loading…
Cancel
Save