mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 07:00:27 +01:00
test: check getcwd() and system() return values in litest
Added code to check for errors in getcwd() and system() that were previously ignored and silently dropped. Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
cd33b3611b
commit
edb69067ef
1 changed files with 15 additions and 3 deletions
|
|
@ -84,8 +84,10 @@ litest_backtrace_get_lineno(const char *executable,
|
|||
char *s;
|
||||
unsigned int i;
|
||||
|
||||
if (!cwd[0])
|
||||
getcwd(cwd, sizeof(cwd));
|
||||
if (!cwd[0]) {
|
||||
if (getcwd(cwd, sizeof(cwd)) == NULL)
|
||||
cwd[0] = 0; /* contents otherwise undefined. */
|
||||
}
|
||||
|
||||
sprintf (buffer,
|
||||
ADDR2LINE " -C -e %s -i %lx",
|
||||
|
|
@ -375,7 +377,17 @@ static struct list all_tests;
|
|||
static void
|
||||
litest_reload_udev_rules(void)
|
||||
{
|
||||
system("udevadm control --reload-rules");
|
||||
int ret = system("udevadm control --reload-rules");
|
||||
if (ret == -1) {
|
||||
litest_abort_msg("Failed to execute: udevadm");
|
||||
} else if (WIFEXITED(ret)) {
|
||||
if (WEXITSTATUS(ret))
|
||||
litest_abort_msg("udevadm failed with %d",
|
||||
WEXITSTATUS(ret));
|
||||
} else if (WIFSIGNALED(ret)) {
|
||||
litest_abort_msg("udevadm terminated with signal %d",
|
||||
WTERMSIG(ret));
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue