X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=assman;a=blobdiff_plain;f=src%2Fassman.c;fp=src%2Fassman.c;h=735cc16e833881499f26fce5b5167373067736fd;hp=2e263e64dd3251b06b8f4761b5492c63e2731bb2;hb=782e5db5669270f2b3046aafc2e909ac3e749393;hpb=b8fc7437862ca32cf79108c7715b8e2566211fb1 diff --git a/src/assman.c b/src/assman.c index 2e263e6..735cc16 100644 --- a/src/assman.c +++ b/src/assman.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "assman_impl.h" static int add_fop(const char *prefix, int type, struct ass_fileops *fop); @@ -108,11 +109,12 @@ ass_file *ass_fopen(const char *fname, const char *mode) void *mfile; ass_file *file; FILE *fp; + const char *after_prefix; m = mlist; while(m) { - if(match_prefix(fname, m->prefix)) { - if((mfile = m->fop->open(fname, m->fop->udata))) { + if((after_prefix = match_prefix(fname, m->prefix))) { + if((mfile = m->fop->open(after_prefix, m->fop->udata))) { if(!(file = malloc(sizeof *file))) { perror("assman: ass_fopen failed to allocate file structure"); m->fop->close(mfile, m->fop->udata); @@ -139,6 +141,7 @@ ass_file *ass_fopen(const char *fname, const char *mode) /* nothing matched, or failed to open, try the filesystem */ if((fp = fopen(fname, mode))) { if(!(file = malloc(sizeof *file))) { + ass_errno = errno; perror("assman: ass_fopen failed to allocate file structure"); fclose(fp); return 0; @@ -153,6 +156,7 @@ ass_file *ass_fopen(const char *fname, const char *mode) } return file; } + ass_errno = errno; return 0; }