aboutsummaryrefslogtreecommitdiffstats
path: root/src/directory_save.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-20 22:18:12 +0200
committerMax Kellermann <max@duempel.org>2008-10-20 22:18:12 +0200
commitba96920a52bbd2208aa1f3b284edc864e26198ce (patch)
tree6750d817780ef892d82e0ce0aecaebd54546799a /src/directory_save.c
parent99e82a2ef293429e3fcc4f6e5d8e7981b4351c7c (diff)
downloadmpd-ba96920a52bbd2208aa1f3b284edc864e26198ce.tar.gz
mpd-ba96920a52bbd2208aa1f3b284edc864e26198ce.tar.xz
mpd-ba96920a52bbd2208aa1f3b284edc864e26198ce.zip
path: replaced mpd_basename() with g_path_get_basename()
GLib's g_path_get_basename() is much more reliable than mpd_basename(). The latter could be tricked into an assertion failure.
Diffstat (limited to '')
-rw-r--r--src/directory_save.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/directory_save.c b/src/directory_save.c
index 51c51c48c..7ee5cbb02 100644
--- a/src/directory_save.c
+++ b/src/directory_save.c
@@ -24,6 +24,8 @@
#include "utils.h"
#include "song_save.h"
+#include <glib.h>
+
/* TODO error checking */
int
directory_save(FILE *fp, struct directory *directory)
@@ -41,9 +43,10 @@ directory_save(FILE *fp, struct directory *directory)
for (i = 0; i < children->nr; ++i) {
struct directory *cur = children->base[i];
- const char *base = mpd_basename(cur->path);
+ char *base = g_path_get_basename(cur->path);
retv = fprintf(fp, DIRECTORY_DIR "%s\n", base);
+ g_free(base);
if (retv < 0)
return -1;
if (directory_save(fp, cur) < 0)