Re: mount_mfs: why chdir?

Rhialto <[email protected]> Sun, 30 Mar 2025 16:08:44 +0200
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <[email protected]>
On Wed 26 Mar 2025 at 09:00:33 -0400, Mouse wrote:
> In sbin/newfs/newfs.c, I see, inter alia,
> 
> int
> main(int argc, char *argv[])
> {
> ...
> #ifdef MFS
> 	if (mfs) {
> ...
> 		(void) chdir("/");
> ...
> 		if (mount(MOUNT_MFS, ...) == -1)
> 
> Does anyone happen to know why the chdir to / is there?  It breaks

Maybe it's just for the case where you're mounting on top of one of your
parent directories? In that case you'd be in a directory that no longer
can be reached.

> /~\ The ASCII				  Mouse
-Olaf.
-- 
___ Olaf 'Rhialto' Seibert                            <rhialto/at/falu.nl>
\X/ There is no AI. There is just someone else's work.           --I. Rose
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEFVAhiiWjqgwBVdQAmYnGRWHD+9MFAmfpUGcACgkQmYnGRWHD
+9Odewf8DAUTM1qsbm58utmE/SdoxzdkYUwQdsQCUcnG33tmIq4ajI5Tmnutns5r
Db9T80o7je40IyalSu/ttZXrlfZOjFv0to6g2thix3psqu4W12emq8xW4V0LZ17w
s3cQjhbmyamiO2o1DK7C52lI0rU21FHo5KPh9NJPjO+0fBPG/aEng7/IgjdXGnW8
PEnOinf+mSmKK45Nnufk7pbIYXA7QA7rqQyo8UM+uUD157sESbWvyfmKASywEMSV
hx0HYrdGXeLQgJGpGagbe2T4pJclhuyEF/BSzLX9zOB2A1yWs03qU7ZqhVNew/8C
NksYHdPImYsULpd0B6a1+k5mJchMUA==
=rn23
-----END PGP SIGNATURE-----