[Bug 232950] execle in FreeBSD work differ than execle in Linux ?

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Nov 4 09:45:12 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=232950

            Bug ID: 232950
           Summary: execle in FreeBSD work differ than execle in Linux ?
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: gnu
          Assignee: bugs at FreeBSD.org
          Reporter: zhecka at gmail.com

FreeBSD execle system call works wrong in code written for Linux.

In many Linux sources i see next system call notation like
execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
               "hypervisor initiated shutdown", (char*)NULL, environ);

Where second argument used as short "program name".
In FreeBSD systems, this argument is not bypassed in call and attached to args
list.

As a result, when the source is ported to FreeBSD, the system call is not
executed correctly.
---- truss output start ----
946: execve("/sbin/shutdown",[ "shutdown", "-h", "-r", "+0", "hypervisor
initiated shutdown" ],0x7fffffffeac0) = 0 (0x0)
946: geteuid() = 0 (0x0)
946: write(2,"shutdown: ",10) = 10 (0xa)
946: write(2,"incompatible switches -c, -h, -k"...,43) = 43 (0x2b)
---- truss output end ----

If we change system call to
execle("/sbin/shutdown", "-h", shutdown_flag, "+0",
               "hypervisor initiated shutdown", (char*)NULL, environ);

all is ok.

But, may be this an error in args parsing in FreeBSD "shutdown" ?

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list