Re: rm/unlink and `how to find out who i am'

看板DFBSD_kernel作者時間21年前 (2005/04/03 02:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/6 (看更多)
--qOrJKOH36bD5yhNe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Apr 02, 2005 at 04:47:28PM +0200, Joerg Sonnenberger wrote: > On Sat, Apr 02, 2005 at 04:05:50PM +0200, Devon H. O'Dell wrote: > > Hey, > >=20 > > I dunno if there are other files that are hard linked together > > and how these are all testing what name they were called by, but > > Liam pointed out the case of rm(1) to me today and asked why it > > was going about that like it was. >=20 > At least gzip and compress come to my mind directly. I'll see what I can do about these two as well. > > I also don't get it. > >=20 > > To me, it seems that something like: > >=20 > > if (strncmp("unlink", basename(*argv)) =3D=3D 0) > >=20 > > would make more sense than how it's doing it now (with a > > temporary pointer to const char and strrchr). I know that > > basename(3) isn't POSIX -- is this an issue? >=20 > Nope, the problem is that basename(3) has a different semantic. > It does strip trailing slashes, which should not happen here. > The easiest and fastest way is calling getprogname(), crt1.c already > did the necessary parsing (with a poor man's version of strrchr BTW). >=20 > Joerg Why should that `not happen here'? Neither unlink nor rm should be called as unlink////. Perhaps I'm misunderstanding. I'll take a look at getprogname. --Devon --qOrJKOH36bD5yhNe Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD4DBQFCTrM6Skf3jVXOdl0RAvCeAJiQ9nC1Z4n/jeAKQR+mo0cfJVfNAJ91l1DM ay9TBWY+CQj895PtjeGMmg== =75Mu -----END PGP SIGNATURE----- --qOrJKOH36bD5yhNe--
文章代碼(AID): #12Jjtk00 (DFBSD_kernel)
討論串 (同標題文章)
文章代碼(AID): #12Jjtk00 (DFBSD_kernel)