This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] sln: Install as a hard link to ldconfig


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

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]