]> git.ipfire.org Git - thirdparty/shadow.git/commit
useradd: make the option specstr passed to getopt_long extensible
authorMasatake YAMATO <yamato@redhat.com>
Wed, 20 Jul 2022 01:43:02 +0000 (10:43 +0900)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Mon, 1 Aug 2022 13:45:10 +0000 (15:45 +0200)
commitfb96d3f84d0e1ee8f987a92eb4ea973b8c20a9c2
tree0d8848cc7a0579a6edb5d73e1397f56e04cef155
parent3ec32f9975f262073f8fbdecd2bfaee4a1d3db48
useradd: make the option specstr passed to getopt_long extensible

It was hard to extend the option specification string passed to
getopt_long as the third argument.

The origian code had a branch with WITH_SELINUX ifdef condition. If
one wants to add one more option char with another ifdef condition
like ENABLE_SUBIDS to the spec, the one must enumerate the specs for
all combinations of the conditions:

*  WITH_SELINUX &&  ENABLE_SUBIDS
*  WITH_SELINUX && !ENABLE_SUBIDS
* !WITH_SELINUX &&  ENABLE_SUBIDS
* !WITH_SELINUX && !ENABLE_SUBIDS

With this change, you can append an option char to the spec.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
src/useradd.c