Alejandro Colomar
2a9b6d80e7
lib/, src/: getulong(): 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
Sebastian Krahmer
1d5a926cc2
Simplify getulong
...
Use strtoul to read an unsigned long, rather than reading
a signed long long and casting it.
https://bugzilla.suse.com/show_bug.cgi?id=979282
2016-08-03 11:51:07 -05:00
nekral-guest
4da0573bf7
* lib/getulong.c: Added splint annotations.
2009-04-30 21:44:35 +00:00
nekral-guest
496002abc9
* lib/Makefile.am, lib/get_pid.c, lib/getulong.c: Added get_pid()
...
and getulong().
2009-04-24 23:28:15 +00:00