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

Devon H. O'Dell dodell at offmyserver.com
Sat Apr 2 07:05:23 PST 2005


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,
> > 
> > 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.
> 
> 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.
> > 
> > To me, it seems that something like:
> > 
> > if (strncmp("unlink", basename(*argv)) == 0)
> > 
> > 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?
> 
> 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).
> 
> 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
Attachment:
pgp00001.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00001.pgp
Type: application/octet-stream
Size: 187 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/kernel/attachments/20050402/e010e9be/attachment-0020.obj>


More information about the Kernel mailing list