unvac, vacfs: allow literal vac scores in addition to file names
This commit is contained in:
parent
405d555fe4
commit
70c9f86c10
1 changed files with 15 additions and 9 deletions
|
|
@ -49,17 +49,23 @@ vacfsopen(VtConn *z, char *file, int mode, int ncache)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
uchar score[VtScoreSize];
|
uchar score[VtScoreSize];
|
||||||
|
char *prefix;
|
||||||
fd = open(file, OREAD);
|
|
||||||
if(fd < 0)
|
if(vtparsescore(file, &prefix, score) >= 0){
|
||||||
return nil;
|
if(strcmp(prefix, "vac") != 0){
|
||||||
|
werrstr("not a vac file");
|
||||||
if(readscore(fd, score) < 0){
|
return nil;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
fd = open(file, OREAD);
|
||||||
|
if(fd < 0)
|
||||||
|
return nil;
|
||||||
|
if(readscore(fd, score) < 0){
|
||||||
|
close(fd);
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
return nil;
|
|
||||||
}
|
}
|
||||||
close(fd);
|
|
||||||
|
|
||||||
return vacfsopenscore(z, score, mode, ncache);
|
return vacfsopenscore(z, score, mode, ncache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue