ref: ee1d11532120bbac4e12e0fed95cf2c1b69bff81
parent: 5ec5ff406eecab8fb2625d5b72d907571a76cea8
author: kvik <kvik@a-b.xyz>
date: Mon Jul 19 13:45:20 EDT 2021
Fix relative branch paths
--- a/unionfs.c
+++ b/unionfs.c
@@ -425,6 +425,7 @@
main(int argc, char *argv[])
{
int c, i, mflag, stdio;
+ char pwd[512];
char *mountat, *srvname, *path;
Dir *d;
Branch *b;
@@ -466,6 +467,8 @@
usage();
if((mountat || srvname) == 0)
mountat = "/mnt/union";
+ if(getwd(pwd, sizeof pwd) == nil)
+ sysfatal("getwd: %r");
nbranch = argc;
branch = b = emalloc(nbranch * sizeof(Branch));
for(i = 0; i < argc; i++){
@@ -474,8 +477,9 @@
c++;
continue;
}
-
path = cleanname(argv[i]);
+ if(!(path[0] == '/' || path[0] == '#'))
+ path = cleanname(smprint("%s/%s", pwd, path));
if((d = dirstat(path)) == nil){
fprint(2, "%s: %s does not exist, skipping\n", argv0, path);
continue;