问题
I am writing a gui wrapper for gcc for a jailbroken iphone, etc. and it is almost done. However, I get this output when it is run ld: can't open output file for writing : a.out, errno=1 collect2:ld return 1 exit status
.
I believe this has to do with the privelages the app runs with. I have tried the setuid trick in the cydia developer faq. Can anyone please help?
EDIT
this is the wrapper I am currently using:#!/usr/bin/bash
dir=$(dirname "$0")
exec "${dir}"/GUI\ GCC_ "$0"
also I used chmod 4777 and changes the owner:group to root:wheel.
Am i doing everything right?
回答1:
It worked when I did it like this:
setuid(0); system("Do root stuff");
// To check who you are system("whoami");
You can install the Package for "ps -U root" to see if you are root, or
回答2:
Be sure your have your setuid binary hidden behind a wrapper that is not setuid. See Cydia or iFile for an example of how it's done.
来源:https://stackoverflow.com/questions/3847239/iphone-run-app-as-root