This commit is by koush and is mostly copied from the CyanogenMod fork of su. By using am instead of a binder transaction, we can guarantee compatibility with current and future versions of Android.
Fixes a bug reported in a comment to the issue #9 against su-binary (see #9 (comment) for details). Thanks to Erik Pilsits (firstname.lastname@example.org) for the report. Add the euid change before populate_environment() anticipating we have to merge the commit "Inherit LD_LIBRARY_PATH ...", which needs root credentials in order to successfully open /proc/<ppid>/environ.
…ss image" This reverts commit e0329ce.
Thus, someone may invoke su as su -s shell uid args... For example, su -s /system/xbin/busybox root mount -o rw,remount /system
So user could distinguish between SIGHUP and other abnormal terminations at least
…) are pressed
Replace atoi(3) by strtoul(3), the latter allows to check parse errors
o use getopt_long(3), so -l, --login can be allowed anywhere in the argument list o add -m and -p which do nothing o su -h outputs usage in stdout and exits with 0 while su with invalid options outputs usage in stderr and exits with 2 now
Data themself aren't changed actually, only comments around the code