Rose
725d3fdc20
Prefer putchar over fputc where possible
...
putchar is easier to understand than fputc and printf and does less work than those two do.
2024-01-13 15:24:43 -07:00
Todd C. Miller
79ed29c4a3
Check sudoers_debug_register() return value.
2023-12-01 15:00:08 -07:00
Todd C. Miller
522f1b634f
tsdump: quiet compiler warnings on some platforms.
...
Quiet a -Wshadow warning from gcc.
Cast major() and minor() to unsigned int when printing.
2023-11-26 09:27:46 -07:00
Todd C. Miller
288593875d
tsdump: display both the terminal path and device number.
...
If no terminal device can be found, print "major, minor" device
numbers instead.
2023-11-26 09:07:25 -07:00
Todd C. Miller
5ff6f49653
tsdump: update to use a uid-based path by default
...
This matches the changes in sudo 1.9.15 to the sudoers policy module.
2023-11-26 08:21:05 -07:00
Todd C. Miller
385d506d35
tsdump: fix compiler warnings
2023-10-18 10:02:16 -06:00
Todd C. Miller
14d514e5ac
Avoid using %zu or %zd with printf() and fprintf().
...
This prevents problems on systems where the system printf(3) is not
C99-compliant. We use our own snprintf() on such systems so that
is safe.
2023-10-17 20:14:53 -06:00
Rose
e095069d2a
Prefer fputs over fprintf where possible
...
fprintf does extra work and meant for formatting strings.
2023-10-15 10:28:57 -06:00
Todd C. Miller
e343e07543
Use #include <foo.h> instead of #include "foo.h" in most cases.
...
We rely on the include path to find many of these headers. It
especially doesn't make sense to use #include "foo.h" for headers
in the top-level include directory.
2023-09-25 10:13:28 -06:00
Todd C. Miller
75209e2718
Rename check.h -> timestamp.h and add remaining timestamp.c prototypes.
2023-08-29 11:16:23 -06:00
Rose
22079c3072
Avoid compiler casting warnings Part 2
...
This saves instructions that are related to casting as well as compiler warnings.
2023-06-29 13:10:27 -04:00
Rose
e54ba33ea0
Avoid compiler casting warnings by assigning to the same type where possible
...
This saves instructions that are related to casting as well as compiler warnings.
2023-06-28 17:25:26 -04:00
Todd C. Miller
e707ffe58b
Place C23 attributes before keywords in function declarations.
...
In practice this means we must use "sudo_noreturn static foo(void)"
instead of "static sudo_noreturn foo(void)".
2022-12-01 12:54:53 -07:00
Todd C. Miller
304726a215
Move gcc-style __attribute__ macros to config.h.in
...
Renamed __malloc -> sudo_malloclike, __printflike -> sudo_printflike,
__printf0like -> sudo_printf0like.
Add sudo_noreturn instead of __attribute__((__noreturn__)).
We do not use stdnoreturn.h since it has been deprecated in C23
in favor of the [[noreturn]] attribute.
2022-09-07 07:48:31 -06:00
Todd C. Miller
bb5843055e
Replace messages like "unknown foo: %s" with "unknown foo %s".
...
The colon really doesn't belong there; we generally use a colon to
separate a message from the warning detail.
2021-08-19 09:44:11 -06:00
Todd C. Miller
84e6e6ccf9
Update copyright year on some files where it was out of date.
2020-08-31 14:09:36 -06:00
Todd C. Miller
985af422d2
Rename __dso_public -> sudo_dso_public and move to config.h.
2020-08-12 09:57:42 -06:00
Todd C. Miller
446ae3f507
Include string.h unconditionally and only use strings.h for strn?casecmp()
...
In the pre-POSIX days BSD had strings.h, not string.h.
Now strings.h is only used for non-ANSI string functions.
2020-05-18 07:59:24 -06:00
Todd C. Miller
dd88460800
We no longer need to include headers we don't use for sudo*.h files.
...
Previously we needed to include headers required by the various
sudo*h files. Now those files are more self-sufficient and we
should only include headers needed by code in the various .c files.
2020-05-18 06:47:04 -06:00
Todd C. Miller
ac61b5655d
Use EXIT_SUCCESS and EXIT_FAILURE more consistently.
2020-02-08 12:43:00 -07:00
Todd C. Miller
486ee2b71f
debug_decl and debug_decl_vars now require a semicolon at the end.
2019-12-22 08:48:16 -07:00
Todd C. Miller
1e1ef61902
Add SPDX-License-Identifier to files.
2019-04-29 07:21:51 -06:00
Todd C. Miller
985600e7f0
Minor snprintf() usage tweaks:
...
1) don't assume snprintf() returns -1 on error, check for <0
2) when comparing return value of sizeof(foo), cast the sizeof, not the len
3) cast return value to void in cases where snprintf cannot fail
2019-01-20 07:49:48 -07:00
Todd C. Miller
6c3d20cb41
Convert PVS-Studio comment to ANSI C.
2018-10-26 08:39:09 -06:00
Todd C. Miller
019279a4b8
Fix some mangled text in the license block.
2018-10-26 08:19:41 -06:00
Todd C. Miller
64e5d34c57
Add comments in .c files so PVS-Studio will check them.
2018-10-21 08:46:05 -06:00
Todd C. Miller
d0d413d077
Cast version to int when printing. Avoids a cppcheck warning.
2018-02-10 04:00:17 -07:00
Todd C. Miller
f7896025ea
treat uid as unsigned in error message
2018-01-15 10:29:38 -07:00
Todd C. Miller
a47f47967c
Convert from mono time to real time before displaying time stamps.
2018-01-12 11:03:22 -07:00
Todd C. Miller
ff5ac3ef0e
Add tsdump, a simple utility to dump a timestamp file. To build,
...
run "make tsdump" in the plugins/sudoers directory (it is not built
by default). In order to map the tty device number to a name,
sudo_ttyname_dev() has been moved into libsudo_util.
2018-01-11 10:49:20 -07:00