aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vac
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2008-06-14 13:41:07 -0400
committerRuss Cox <rsc@swtch.com>2008-06-14 13:41:07 -0400
commit70c9f86c100042ce308bc53e63c72f36be5e7f86 (patch)
tree2082fb5841b70e1692085278962cc1205f119de9 /src/cmd/vac
parent405d555fe44ab53be9887fd2765f05a4501cf756 (diff)
downloadplan9port-70c9f86c100042ce308bc53e63c72f36be5e7f86.tar.gz
plan9port-70c9f86c100042ce308bc53e63c72f36be5e7f86.tar.bz2
plan9port-70c9f86c100042ce308bc53e63c72f36be5e7f86.zip
unvac, vacfs: allow literal vac scores in addition to file names
Diffstat (limited to 'src/cmd/vac')
-rw-r--r--src/cmd/vac/fs.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/cmd/vac/fs.c b/src/cmd/vac/fs.c
index d9ab258c..9d3bb349 100644
--- a/src/cmd/vac/fs.c
+++ b/src/cmd/vac/fs.c
@@ -49,17 +49,23 @@ vacfsopen(VtConn *z, char *file, int mode, int ncache)
{
int fd;
uchar score[VtScoreSize];
-
- fd = open(file, OREAD);
- if(fd < 0)
- return nil;
-
- if(readscore(fd, score) < 0){
+ char *prefix;
+
+ if(vtparsescore(file, &prefix, score) >= 0){
+ if(strcmp(prefix, "vac") != 0){
+ werrstr("not a vac file");
+ return nil;
+ }
+ }else{
+ fd = open(file, OREAD);
+ if(fd < 0)
+ return nil;
+ if(readscore(fd, score) < 0){
+ close(fd);
+ return nil;
+ }
close(fd);
- return nil;
}
- close(fd);
-
return vacfsopenscore(z, score, mode, ncache);
}