[totem] Fix spurious errors when running nice()
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [totem] Fix spurious errors when running nice()
- Date: Mon, 16 Nov 2009 13:39:25 +0000 (UTC)
commit 26947d6f667405332147a576db5ca3bc12ccaa8d
Author: Bastien Nocera <hadess hadess net>
Date: Mon Nov 16 13:21:00 2009 +0000
Fix spurious errors when running nice()
Check the value of errno before saying that nice() fails, as
per the nice(3p) man page.
src/totem-video-thumbnailer.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/totem-video-thumbnailer.c b/src/totem-video-thumbnailer.c
index 4ec3c01..f246a0f 100644
--- a/src/totem-video-thumbnailer.c
+++ b/src/totem-video-thumbnailer.c
@@ -32,6 +32,7 @@
#include <glib/gi18n.h>
#include <cairo.h>
+#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
@@ -774,11 +775,6 @@ int main (int argc, char *argv[])
const char *input, *output;
callback_data data;
-#ifdef G_OS_UNIX
- if (nice (20) != 20)
- g_warning ("Couldn't change nice value of process.");
-#endif
-
g_thread_init (NULL);
context = g_option_context_new ("Thumbnail movies");
@@ -797,6 +793,14 @@ int main (int argc, char *argv[])
return 1;
}
+#ifdef G_OS_UNIX
+ if (time_limit != FALSE) {
+ errno = 0;
+ if (nice (20) != 20 && errno != 0)
+ g_warning ("Couldn't change nice value of process.");
+ }
+#endif
+
if (print_progress) {
fcntl (fileno (stdout), F_SETFL, O_NONBLOCK);
setbuf (stdout, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]