Commit f02de0e9 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵
Browse files

ptp-helper: Make sure to use g_poll() for the main context

The modified main context from https://bugzilla.gnome.org/show_bug.cgi?id=741054
somehow calls setugid(), which abort()s setuid root applications on OSX.
parent c7c1dcd3
......@@ -612,6 +612,14 @@ write_clock_id (void)
}
}
#ifdef __APPLE__
static gint
dummy_poll (GPollFD * fds, guint nfds, gint timeout)
{
return g_poll (fds, nfds, timeout);
}
#endif
gint
main (gint argc, gchar ** argv)
{
......@@ -619,6 +627,20 @@ main (gint argc, gchar ** argv)
GMainLoop *loop;
GError *err = NULL;
/* FIXME: Work around some side effects of the changes from
* https://bugzilla.gnome.org/show_bug.cgi?id=741054
*
* The modified poll function somehow calls setugid(), which
* then abort()s the application. Make sure that we use g_poll()
* here!
*/
#ifdef __APPLE__
{
GMainContext *context = g_main_context_default ();
g_main_context_set_poll_func (context, dummy_poll);
}
#endif
#ifdef HAVE_PTP_HELPER_SETUID
if (setuid (0) < 0)
g_error ("not running with superuser privileges");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment