From 6b42686e8addecf76beaa171427a81fd65c6a895 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sun, 22 Sep 2013 03:58:59 +0200 Subject: main: enclose libimobiledevice related code in #ifdefs --- src/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.c b/src/main.c index 7ae3532..dfa16d0 100644 --- a/src/main.c +++ b/src/main.c @@ -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)"); -- cgit v1.1-32-gdbae