Alejandro Colomar
6bec1cf37c
lib/: Use 'restrict' alongside [[gnu::access()]]
...
const + restrict imply read_only.
Cc: Serge Hallyn <serge@hallyn.com >
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-01-15 13:14:28 -06:00
Alejandro Colomar
561448443f
lib/: get[u]long(): Use ATTR_ACCESS() instead of /*@out@*/
...
Link: <https://splint.org/manual/manual.html#undefined >
Cc: Serge Hallyn <serge@hallyn.com >
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-01-15 13:14:28 -06:00
Alejandro Colomar
2d581cb337
lib/, src/: getlong(): Use the usual -1 as an error code
...
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-01-05 16:54:55 -06:00
Alejandro Colomar
1c464d9a2d
lib/, src/: Fix error handling after strto[u]l[l](3)
...
- Set errno = 0 before the call. Otherwise, it may contain anything.
- ERANGE is not the only possible errno value of these functions. They
can also set it to EINVAL.
- Any errno value after these calls is bad; just compare against 0.
- Don't check for the return value; just errno. This function is
guaranteed to not modify errno on success (POSIX).
- Check endptr == str, which may or may not set EINVAL.
Suggested-by: Iker Pedrosa <ipedrosa@redhat.com >
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2023-12-04 12:21:55 +01:00
Alejandro Colomar
4f16458b6c
lib/, src/: Say 'long' instead of 'long int'
...
We were using 'long' in most places, so be consistent and use it
everywhere.
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2023-12-03 09:58:19 -06:00
Serge Hallyn
f93cf255d4
Update licensing info
...
Closes #238
Update all files to list SPDX license shortname. Most files are
BSD 3 clause license.
The exceptions are:
serge@sl ~/src/shadow$ git grep SPDX-License | grep -v BSD-3-Clause
contrib/atudel:# SPDX-License-Identifier: BSD-4-Clause
lib/tcbfuncs.c: * SPDX-License-Identifier: 0BSD
libmisc/salt.c: * SPDX-License-Identifier: Unlicense
src/login_nopam.c: * SPDX-License-Identifier: Unlicense
src/nologin.c: * SPDX-License-Identifier: BSD-2-Clause
src/vipw.c: * SPDX-License-Identifier: GPL-2.0-or-later
Signed-off-by: Serge Hallyn <serge@hallyn.com >
2021-12-23 19:36:50 -06:00
nekral-guest
e8dd48ac09
* lib/getlong.c: Do not check for NULL string but empty string.
2009-04-24 23:27:12 +00:00
nekral-guest
614c79defc
* libmisc/xgetXXbyYY.c, libmisc/myname.c, libmisc/getgr_nam_gid.c,
...
libmisc/salt.c, libmisc/list.c, libmisc/cleanup.c, src/login.c,
lib/getdef.h, lib/groupio.c, lib/getlong.c, lib/gshadow_.h,
lib/sgroupio.c, lib/shadowio.c, lib/pwio.c, lib/commonio.h,
lib/fputsx.c, lib/prototypes.h: Added splint annotations.
* lib/groupio.c: Avoid implicit conversion of pointers to
booleans.
* lib/groupio.c: Free allocated buffers in case of failure.
2009-04-23 09:57:03 +00:00
nekral-guest
a24058d660
* NEWS, srclib/getlong.c: Fix parsing of octal numbers.
...
* NEWS, src/login.c: Fix segfault when no user is provided on the
command line.
2009-04-15 17:50:17 +00:00
nekral-guest
84f5ca951c
* lib/getdef.c: Use getlong instead of strtol/strtoul.
...
* libmisc/getlong, lib/getlong.c, libmisc/Makefile.am,
lib/Makefile.am: getlong.c moved from libmisc/ to lib/.
2009-04-10 22:35:26 +00:00