DragonFly BSD
DragonFly kernel List (threaded) for 2005-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

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

From: Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx>
Date: Sat, 2 Apr 2005 17:39:12 +0200
Mail-followup-to: kernel@crater.dragonflybsd.org

On Sat, Apr 02, 2005 at 04:59:06PM +0200, Devon H. O'Dell  wrote:
> > 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.

That's exactly the reason why. It doesn't matter if they are called
/tmp/unlink////, because some stupid caller didn't include the final
rm (/tmp/unlink////rm). Just use getprogname() for this, the only exception
would be a program messing with argv[0] first and expecting getprogname()
to work later, but for that you can always call setprogname() too.


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