diff --git a/ChangeLog b/ChangeLog index fe986b1221..ed6693bca4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-09-29 Michael Natterer + + * libgimp/gimp.c (gimp_extension_process): loop around select() as + long as it returns EINTR. Enables debugging of script-fu on + OSX (and maybe all BSDish systems). + 2007-09-28 Sven Neumann * plug-ins/script-fu/script-fu-console.c: allocate the diff --git a/libgimp/gimp.c b/libgimp/gimp.c index 41f7a26133..b9ad3dfbba 100644 --- a/libgimp/gimp.c +++ b/libgimp/gimp.c @@ -1339,32 +1339,37 @@ void gimp_extension_process (guint timeout) { #ifndef G_OS_WIN32 - fd_set readfds; - gint select_val; - struct timeval tv; - struct timeval *tvp; + gint select_val; - if (timeout) + do { - tv.tv_sec = timeout / 1000; - tv.tv_usec = (timeout % 1000) * 1000; - tvp = &tv; - } - else - tvp = NULL; + fd_set readfds; + struct timeval tv; + struct timeval *tvp; - FD_ZERO (&readfds); - FD_SET (g_io_channel_unix_get_fd (_readchannel), &readfds); + if (timeout) + { + tv.tv_sec = timeout / 1000; + tv.tv_usec = (timeout % 1000) * 1000; + tvp = &tv; + } + else + tvp = NULL; - if ((select_val = select (FD_SETSIZE, &readfds, NULL, NULL, tvp)) > 0) - { - gimp_single_message (); - } - else if (select_val == -1) - { - perror ("gimp_extension_process"); - gimp_quit (); + FD_ZERO (&readfds); + FD_SET (g_io_channel_unix_get_fd (_readchannel), &readfds); + + if ((select_val = select (FD_SETSIZE, &readfds, NULL, NULL, tvp)) > 0) + { + gimp_single_message (); + } + else if (select_val == -1 && errno != EINTR) + { + perror ("gimp_extension_process"); + gimp_quit (); + } } + while (select_val == -1 && errno == EINTR); #else /* Zero means infinite wait for us, but g_poll and * g_io_channel_win32_poll use -1 to indicate