#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <errno.h>
#include "assman_impl.h"
static int add_fop(const char *prefix, int type, struct ass_fileops *fop);
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);
/* 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;
}
return file;
}
+ ass_errno = errno;
return 0;
}