Re: #! and argv[0]: the path is removed before invoking the interpreter

From: Wakko Warner (wakko@animx.eu.org)
Date: Wed Feb 16 2000 - 19:00:03 EST


> What full path? There can be many. Or none. It could be deleted right after
> it starts up.
>
> There is no such thing as "the path to the current executable" in Unix.
>
> (In Linux 2.2 and up, readlink(/proc/self/exe) is close)

Question: I wrote a few programs that would check it's own executable to
determin if it was set[ug]id. If it was, it would assume something bad is
happening and not run. Is there a way to get that information (I don't want
to test euid and uid, they could be different but the program not suid)
without using /proc? I foolishly tryied opening argv[0] and aborting if it
wasn't openable.

-- 
 Lab tests show that use of micro$oft causes cancer in lab animals

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Feb 23 2000 - 21:00:17 EST