commit 5e2c089b18cfcabb06383e6cb7a25b2be7d11efe
parent 86e97ab53472604d02536eba20268fecb6593e24
Author: Jesus Galan Lopez (yiyus) <yiyu.jgl@gmail.com>
Date: Sat, 11 Sep 2010 22:37:14 +0200
fix localroot=- in ini files
Diffstat:
3 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/src/9vx/conf.c b/src/9vx/conf.c
@@ -192,6 +192,8 @@ printconfig(char *argv0){
}
if(localroot)
print(" -r %s", localroot);
+ else if(!fsdev)
+ print(" -r -");
print(" -u %s", username);
for(i = 0; i < bootargc; i++)
print(" %s", bootargv[i]);
diff --git a/src/9vx/conf.h b/src/9vx/conf.h
@@ -5,6 +5,7 @@
char inibuf[BOOTARGSLEN];
char *iniline[MAXCONF];
int cpulimit; /* max cpu usage */
+int fsdev; /* create fs device */
int initrc; /* run rc instead of init */
int nofork; /* do not fork at init */
int nogui; /* do not start the gui */
diff --git a/src/9vx/main.c b/src/9vx/main.c
@@ -93,6 +93,7 @@ main(int argc, char **argv)
quotefmtinstall();
cpulimit = 0;
+ fsdev = 1;
inifile = nil;
memset(iniline, 0, MAXCONF);
memmb = 0;
@@ -190,20 +191,21 @@ main(int argc, char **argv)
bootargv = argv;
/*
* bootargs have preference over -r
+ * if localroot is -, keep it for printconfig
*/
- fsdev = strcmp(localroot, "-");
- if(fsdev){
+ if(bootargc > 0 && strcmp(localroot, "-") != 0)
+ localroot = nil;
+
+ inifields(&iniopt);
+
+ if(localroot && strcmp(localroot, "-") == 0){
+ fsdev = 0;
+ localroot = nil;
// remove #Z device from devtab
for(int i=0; devtab[i] && devtab[i] != &fsdevtab; i++)
if(devtab[i] == &fsdevtab)
devtab[i] = 0;
}
-
- // keep localroot for printconfig if !fsdevtab
- if(bootargc > 0 && fsdev)
- localroot = nil;
-
- inifields(&iniopt);
if(username == nil && (username = getuser()) == nil)
username = "tor";
@@ -236,8 +238,6 @@ main(int argc, char **argv)
siginit();
printconfig(argv0);
- if(!fsdev)
- localroot = nil;
if(nve == 0)
ipdevtab = pipdevtab;
@@ -252,8 +252,7 @@ main(int argc, char **argv)
if(!singlethread){
if(nve == 0)
makekprocdev(&ipdevtab);
- if(fsdev)
- makekprocdev(&fsdevtab);
+ makekprocdev(&fsdevtab);
makekprocdev(&drawdevtab);
makekprocdev(&audiodevtab);
if(nocpuload == 0)