[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

promised statfs patch



No, this is not that patch I promised to do so long. This is just a
question how to actually do that patch.

Problem: both chdir("./") and statfs("./", &x) fail under TOS when the
CWD is root of a drive. chdir() reports -1, while statfs() goes crazy
and displays alertbox ("insert drive X into A:" - caused me a lot of
headaches!). The workaround for both is to use CWD as the parameter for
the call, i.e.

if (path == "./")
   path = getcwd()	/* path is now like "/dev/c/" */

and now we can call chdir(path) or statfs(path, &x) safely.

Actually, the chdir("./") could probably be safely omitted (could
really be?). But the statfs() needs to be patched.

So I suggest to do (and I will do that and prepare the patch if nobody
comes with better solution):

in chdir(path):

if (!strcmp(path,"./") || !strcmp(path,".\"))
	return 0;

in statfs(path, struct statfs *x):

if (!strcmp(path,"./") || !strcmp(path,".\"))
    getcwd(tmp_path);
else
	strcpy(tmp_path, path);

Please let me know soon if there's a better solution to these problems.

Petr
--
E-mail: stehlik@cas3.zlin.vutbr.cz                        PARCP developer
   WWW: http://cas3.zlin.vutbr.cz/~stehlik/              MiNTOS/Linux user
mirror: http://users.zln.cz/~pstehlik/                 Atari 800XL emulation
mirror: http://www.stehlik.cyberstrider.org/              Atari Falcon040