Fix listing id of empty zet

main
cel 5 years ago
parent e61a89defd
commit 51b30415db
Signed by: cel
GPG Key ID: C28D95BB012367EA

@ -228,13 +228,14 @@ static char *zet_get_title(const char *id, char *buf, size_t len) {
if (sz < 0 || (size_t)sz >= sizeof(path_buf)) return NULL; if (sz < 0 || (size_t)sz >= sizeof(path_buf)) return NULL;
int fd = open(path_buf, O_RDONLY); int fd = open(path_buf, O_RDONLY);
if (fd < 0) return NULL; if (fd < 0) return NULL;
buf = zet_get_title_fd(fd, buf, len); char *title_buf = zet_get_title_fd(fd, buf, len);
if (buf != NULL && *buf == '\0') { if (title_buf == NULL || *title_buf == '\0') {
strncpy(buf, "§", sigil_size); strncpy(buf, "§", sigil_size);
strncpy(buf + sigil_size, id, len); strncpy(buf + sigil_size, id, len);
title_buf = buf;
} }
close(fd); close(fd);
return buf; return title_buf;
} }
static int zet_stat(const char *id, struct stat *st) { static int zet_stat(const char *id, struct stat *st) {

Loading…
Cancel
Save