diff options
author | Nikias Bassen | 2013-09-22 03:58:59 +0200 |
---|---|---|
committer | Nikias Bassen | 2013-09-22 03:58:59 +0200 |
commit | 6b42686e8addecf76beaa171427a81fd65c6a895 (patch) | |
tree | a0fddb1de38a601ecc64c4933dc27e777ccb225d /src/main.c | |
parent | 4514713b00a8bc3685f22c89d29963f10d46789e (diff) | |
download | usbmuxd-6b42686e8addecf76beaa171427a81fd65c6a895.tar.gz usbmuxd-6b42686e8addecf76beaa171427a81fd65c6a895.tar.bz2 |
main: enclose libimobiledevice related code in #ifdefs
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -47,7 +47,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include "device.h" #include "client.h" +#ifdef HAVE_LIBIMOBILEDEVICE extern const char* userpref_get_config_dir(); +#endif static const char *socket_path = "/var/run/usbmuxd"; static const char *lockfile = "/var/run/usbmuxd.pid"; @@ -530,6 +532,7 @@ int main(int argc, char *argv[]) if(listenfd < 0) goto terminate; +#ifdef HAVE_LIBIMOBILEDEVICE const char* userprefdir = userpref_get_config_dir(); struct stat fst; @@ -538,6 +541,7 @@ int main(int argc, char *argv[]) mkdir(userprefdir, 0775); userprefdir_created = 1; } +#endif // drop elevated privileges if (drop_privileges && (getuid() == 0 || geteuid() == 0)) { @@ -556,6 +560,7 @@ int main(int argc, char *argv[]) if (pw->pw_uid == 0) { usbmuxd_log(LL_INFO, "Not dropping privileges to root"); } else { +#ifdef HAVE_LIBIMOBILEDEVICE if (userprefdir_created) { if (chown(userprefdir, pw->pw_uid, pw->pw_gid) < 0) { usbmuxd_log(LL_WARNING, "chown(%s, %d, %d) failed", userprefdir, pw->pw_uid, pw->pw_gid); @@ -564,6 +569,7 @@ int main(int argc, char *argv[]) usbmuxd_log(LL_WARNING, "chmod %s failed", userprefdir); } } +#endif if ((res = initgroups(drop_user, pw->pw_gid)) < 0) { usbmuxd_log(LL_FATAL, "Failed to drop privileges (cannot set supplementary groups)"); |