Closed PerfectSlayer closed 7 years ago
Mmmm, to me this check is the right way. Let me explain what this does.
Standard superuser.zip changes init.rc so that PATH includes /sbin. Now, some apps first checks /system/xbin/su before checking $PATH, because of historical reasons. If /system/xbin/su isn't there, they behave properly and go check what's in $PATH But if /system/xbin/su exists, then it calls it instead of /sbin/su. This is a problem for the ROMs which provide their own SU, because they'll most likely be broken by my SU.
So this functions replaces /system/xbin/su with my su if it already exists.
Does this look right to you, and does this make sense? If so, I'll add this comment in the source code of that function to make the use-case explicit.
Thanks for the explanation! It would be definitively better if the documentation comes the code 👍
By the way, I'm still looking why I need to change this code to have su --bind working. Maybe there is a side effect which is needed in my case. I'm still looking at it.
So I close the PR.
/system/xbin/su presence is checked before trying to mount it. The check was inverted. If bound su is missing, prepare method exits instead of mounting su file.