THE-Spellchecker
5eba4b48cf
Typographical and Grammatical fixes
2023-11-28 15:00:04 -07: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
811051d32a
Use int, not short for events in the event API.
...
This fixes some -Wconversion warnings and fixes an inconsistency
between the libsudo_util event API and the plugin event API. The
actual struct internals still use shorts to avoid changing the ABI.
2023-08-09 13:22:12 -06:00
Todd C. Miller
4f097eebd3
libsudo_util: make more bit flags unsigned.
2023-07-10 11:06:04 -06: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
Rose
7fd680c983
Do variable length arrays the C99 way
...
Variable length arrays are supported by C99, but having it denoted as "1" confused the compiler and is not defined.
Note that because we don't get the inferred NULL terminator, we have to increase the malloc size by one.
2023-06-15 15:25:17 -04:00
Todd C. Miller
fa5d44b8b5
Quiet some clang 10 analyzer warnings.
2020-08-07 14:22:56 -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
0460008c5b
Handle EAGAIN like we do ENOMEM from poll() and select().
...
On some systems, poll() and select() can return EAGAIN instead
of ENOMEM if there is a kernel resource shortage. In this case
we just re-enter the event loop and retry.
2020-05-04 11:23:35 -06:00
Todd C. Miller
85fe30e49b
The timeout parameter of sudo_ev_add() should be const.
2020-04-29 11:27:30 -06:00
Todd C. Miller
d83c09fb66
Add SUDO_EV_MASK to mask off invalid event values.
...
Now used by sudo_ev_init() to avoid bogus events.
2020-03-12 14:00:15 -06:00
Todd C. Miller
161750fc56
Really fix flushing of data in client_close().
...
Now that we call fmt_exit_message() from client_close() we do not
need to try to determine whether the read or write events were
pending in the old base.
We can't tell anyway because the active flag in the event was cleared
when the old sudo event base was destroyed. It is correct to enable
both the read and write events after formatting the ExitMessage.
2020-01-15 14:47:42 -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
22ffffe12b
Add sudo_ev_pending(), used to check whether an event is pending.
2019-12-07 08:42:08 -07:00
Todd C. Miller
5793023ffd
Add a plugin interface to sudo main event loop.
2019-11-15 13:36:01 -07:00
Todd C. Miller
f6acc134f4
When freeing an event base, reset ev->base to NULL for associated events.
2019-11-15 13:35:19 -07:00
Todd C. Miller
8c96df036a
Fix sorting of the time-based event queue.
2019-09-13 16:49:13 -06:00
Todd C. Miller
751c0c4440
Support default base in got_exit, got_break, loopexit, loopbreak, loopcontinue
2019-09-13 16:26:09 -06:00
Todd C. Miller
1e1ef61902
Add SPDX-License-Identifier to files.
2019-04-29 07:21:51 -06:00
Todd C. Miller
6c3d20cb41
Convert PVS-Studio comment to ANSI C.
2018-10-26 08:39:09 -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
939585e906
tv_nsec can never be negative after timespecsub.
...
Found by PVS Studio
2018-10-17 06:21:48 -06:00
Todd C. Miller
63f7aa8fcf
Backward ABI compatibility for even functions that use a timeval.
2018-08-25 21:02:07 -06:00
Todd C. Miller
6b76f9dbd3
Use a monotonic timer for the event subsystem.
2018-08-25 21:02:06 -06:00
Todd C. Miller
04d1f56d90
Use struct timespec, not struct timeval in the event subsystem.
...
Use ppoll() or pselect() if avaialble which use timespec.
2018-08-25 21:02:05 -06:00
Todd C. Miller
42fe0409f6
Add sudo_ev_dispatch(), a wrapper for ev_loop() with no flags.
...
Similar the dispatch function in libevent.
2018-02-19 11:00:10 -07:00
Todd C. Miller
48fba3c2cc
update my email to Todd.Miller@sudo.ws
2017-12-03 17:53:40 -07:00
Todd C. Miller
fdff345e0f
The read and write sides of signal_pipe[] were swapped, resulting
...
in EBADF reading from and writing to the signal pipe on Linux and
probably others. On systems with bidirectional pipes this was not
an issue.
2017-09-06 12:29:36 -06:00
Todd C. Miller
7f8765d327
If we free the default base in sudo_ev_base_free(), reset the default
...
base to NULL.
2017-07-14 10:09:58 -06:00
Todd C. Miller
d2a0bfbb12
Add the ability to set a default event base, to be used by plugins
...
which don't have access to the event base.
2017-07-13 13:59:31 -06:00
Todd C. Miller
88bf0337e9
Move the bits to fill in the new event base to sudo_ev_base_init(),
...
which is not currently exported.
2017-06-01 09:45:23 -06:00
Todd C. Miller
95e92bfe4e
Activate the sigevents inside the signal pipe callback itself
...
and call signal_pipe_cb() directly if the backend returns EINTR
and the signal_caught flag is set. This has the side effect of
processing signal events in the current pass of the event loop
instead of the next one.
2017-05-12 10:02:17 -06:00
Todd C. Miller
9d4a92b9b4
Handle the possibility of the siginfo parameter in sa_sigaction
...
handler being NULL.
2017-05-12 10:02:17 -06:00
Todd C. Miller
2a55808775
Add support for signal events in sudo's event subsystem
2017-05-12 10:02:17 -06:00
Todd C. Miller
223b251c19
Improve debug info in sudo_ev_add() and sudo_ev_del()
2016-05-20 10:14:38 -06:00
Todd C. Miller
f2f5c2949c
Add line number to debug log for memory allocation errors.
2015-07-14 14:47:12 -06:00
Todd C. Miller
0b241088b3
There's no need to conditionalize the #include <unistd.h>, we require
...
a POSIX system.
2015-07-02 09:08:28 -06:00
Todd C. Miller
4a07b472f0
Only include stddef.h where it is needed.
2015-06-20 05:34:35 -06:00
Todd C. Miller
dc883f2454
We require ANSI C so stop using the obsolete STDC_HEADERS.
2015-06-19 14:29:27 -06:00
Todd C. Miller
c0fa0e248d
Add debugging output on memory alloc failure.
...
Add missing checks in event_select.c for reallocarray() failure.
2015-06-05 13:18:48 -06:00
Todd C. Miller
6741fb5378
Use non-exiting allocators.
2015-05-20 10:39:08 -06:00
Todd C. Miller
59ab26dbcc
Go back to a 2 args debug_decl and just use the "default" instance,
...
now renamed "active".
2015-02-01 08:24:49 -07:00
Todd C. Miller
866cfc4fc3
Add support for multiple Debug lines per program. Callers may
...
register arbitrary debug facilities or use built-in defaults. We
now use separate Debug statements for plugins and programs.
2014-10-22 13:23:05 -06:00
Todd C. Miller
f95ca8d4f0
Remove confusing comment.
2014-09-02 15:00:23 -06:00
Todd C. Miller
2b849b2687
Don't allow sudo_ev_loopcont() to override sudo_ev_loopexit()
2014-08-29 09:47:08 -06:00
Todd C. Miller
e9370718f9
Add some internal convenience functions.
2014-08-29 09:44:08 -06:00
Todd C. Miller
47835ff289
Rename missing.h -> sudo_compat.h
2014-07-22 14:25:16 -06:00
Todd C. Miller
844a285391
Version the functions in libsudo_util
2014-07-22 11:26:17 -06:00
Todd C. Miller
3687b665cb
Rename fatal.h -> sudo_fatal.h
2014-07-21 14:40:18 -06:00
Todd C. Miller
36a5767e3e
efree -> sudo_efree for consistency
2014-07-10 15:35:04 -06:00