diff options
author | Sigrid Solveig Haflínudóttir <sigrid@ftrv.se> | 2022-08-25 21:46:24 +0000 |
---|---|---|
committer | Sigrid Solveig Haflínudóttir <sigrid@ftrv.se> | 2022-08-25 21:46:24 +0000 |
commit | 5c78e0bd5789829aace4ccc798d672d7bc8b459f (patch) | |
tree | 6cfa55fa242822b1c67a5734ac3c97b7aa1579a9 /sys/src/cmd/audio | |
parent | e2124b109ecb0f5634f036e392d827b6ddebec54 (diff) |
audio/mkplist: don't fail entirely if a directory is not accessible
Diffstat (limited to 'sys/src/cmd/audio')
-rw-r--r-- | sys/src/cmd/audio/zuke/mkplist.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/src/cmd/audio/zuke/mkplist.c b/sys/src/cmd/audio/zuke/mkplist.c index dbc51350e..6f1bfe41e 100644 --- a/sys/src/cmd/audio/zuke/mkplist.c +++ b/sys/src/cmd/audio/zuke/mkplist.c @@ -47,8 +47,10 @@ newmeta(void) else if((numall & (numall-1)) == 0) all = realloc(all, numall*2*sizeof(Meta)); - if(all == nil) + if(all == nil){ + sysfatal("newmeta: no memory"); return nil; + } memset(&all[numall++], 0, sizeof(Meta)); return &all[numall-1]; @@ -184,8 +186,7 @@ scanfile(char *path) fprint(2, "%s: %r\n", path); return; } - if((curr = newmeta()) == nil) - sysfatal("no memory"); + curr = newmeta(); firstiscomposer = keepfirstartist = 0; res = tagsget(&ctx); if(ctx.format != Funknown){ @@ -227,11 +228,13 @@ scan(char **dir, int depth) long n; int dirfd, len; - if((dirfd = open(*dir, OREAD)) < 0) - sysfatal("%s: %r", *dir); + if((dirfd = open(*dir, OREAD)) < 0){ + fprint(2, "scan: %r\n"); + return -1; + } len = strlen(*dir); if((*dir = realloc(*dir, len+1+Maxname)) == nil) - sysfatal("no memory"); + sysfatal("scan: no memory"); path = *dir; path[len] = '/'; @@ -346,8 +349,7 @@ main(int argc, char **argv) for(i = 0; i < argc; i++){ if(strncmp(argv[i], "http://", 7) == 0 || strncmp(argv[i], "https://", 8) == 0){ - if((curr = newmeta()) == nil) - sysfatal("no memory"); + curr = newmeta(); curr->title = argv[i]; curr->path = argv[i]; curr->filefmt = ""; |