dbus-uuidgen: Enable stack memory protection

Use "return" instead of "exit()" at the end of the main() function to
enable runtime stack overflow checks.

Using "return" allows the program to exit normally from main(), letting
the compiler perform necessary cleanup operations, including stack
canary verification.

When using "exit()" at the end of main(), the __stack_chk_fail function
is not invoked.

$ objdump -T ./util/.libs/mtp-hotplug | grep __stack_chk_fail
(This returns empty.)

Signed-off-by: Hieu Nguyen <nvhieudt11@gmail.com>
This commit is contained in:
Hieu Van Nguyen 2025-10-09 11:34:43 +09:00
parent 1bcf396c78
commit eac87979dc

View file

@ -125,7 +125,7 @@ main (int argc, char *argv[])
if (get_uuid && ensure_uuid)
{
fprintf (stderr, "Can't specify both --get and --ensure\n");
exit (1);
return 1;
}
dbus_error_init (&error);
@ -155,10 +155,10 @@ main (int argc, char *argv[])
{
fprintf (stderr, "%s\n", error.message);
dbus_error_free (&error);
exit (1);
return 1;
}
else
{
exit (0);
return 0;
}
}