Linux-kernel mailing list archive 2000-07,: Re: #! and argv[0]: the path is removed before invoking the interpreter

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

Wakko Warner (wakko@animx.eu.org)
Wed, 16 Feb 2000 19:00:03 -0500

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Brent M. Smith: "[2.3.46]: ll_rw_blk.o: Compile error"
- Previous message: Jeremy Fitzhardinge: "TCP bug? hanging outgoing connections in 2.2.14"

> 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/

- Next message: Brent M. Smith: "[2.3.46]: ll_rw_blk.o: Compile error"
- Previous message: Jeremy Fitzhardinge: "TCP bug? hanging outgoing connections in 2.2.14"