Bug 4225

Summary: acpid.c executes "wrong" script/binary
Product: Busybox Reporter: pzy <pzychofaze>
Component: OtherAssignee: unassigned
Status: NEW ---    
Severity: minor CC: busybox-cvs
Priority: P5    
Version: 1.19.x   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:

Description pzy 2011-09-21 12:28:25 UTC
while playing around with busybox acpid i found that if i add a line like
PWRF   /scripts/poweroff.sh
to acpid.conf where /scripts/poweroff.sh is an absolute path to a poweroff script then the code would check via stat if the file exists but would execute the file .//scripts/poweroff.sh in the current working directory (which is /etc/acpi).
I don't know if its correct that the scripts should only be executed if they are in /etc/acpi, in my case i wanted to execute a script with an absolute path so i changed the process_event-code in acpid.c line 120 to
        char *handler = xasprintf("%s", event);
patch1 attached

if its correct that the scripts should only be executed when they are in /etc/acpi i guess the stat in line 132 should be changed to
        if (0 == stat(handler, &st))

I guess one of these should be correct. Or the handler variable could be removed to use the event variable direct