[PATCH] sln: Install as a hard link to ldconfig
Mike Frysinger
vapier@gentoo.org
Thu Jul 21 08:56:00 GMT 2016
On 13 Jul 2016 14:17, Florian Weimer wrote:
> +/* Check if we have to run sln. */
> +bool
> +run_sln (const char *argv0)
> +{
> + const char *slash = strrchr (argv0, '/');
> + const char *progname;
> + if (slash == NULL)
> + progname = argv0;
> + else
> + progname = slash + 1;
> + return strcmp (progname, "sln") == 0;
> +}
GNU programming conventions say to not rely on argv[0] to change
behavior:
https://www.gnu.org/prep/standards/html_node/_002d_002dversion.html
as a practical example, it is trivial for argv[0] to be anything
(including NULL) which would confuse this test.
at the very least, you should use program_invocation_short_name
instead of parsing argv[0] yourself. not that that addresses
the concern above since that internally is based on argv[0].
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160721/35bcf6ed/attachment.sig>
More information about the Libc-alpha
mailing list