X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=gui.c;h=8e70dd93b4d3a5d3d7b35a3c7ec65723d7639f24;hp=fa1538b0d63f3db2ca8be6497aa0ce797d3a89a1;hb=b62e2796b85c7d7f3138fe729f4637853e0fafe0;hpb=840725e10602abd8187428924040f4bf3e04594c diff --git a/gui.c b/gui.c index fa1538b0..8e70dd93 100644 --- a/gui.c +++ b/gui.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998-2010 Andre Noll + * Copyright (C) 1998-2011 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -294,9 +294,9 @@ static int align_str(WINDOW* win, char *str, unsigned int len, str[len] = '\0'; num = 0; } - /* replace newlines by spaces */ + /* replace control characters by spaces */ for (i = 0; i < len && str[i]; i++) { - if (str[i] == '\n') + if (str[i] == '\n' || str[i] == '\r' || str[i] == '\f') str[i] = ' '; } if (align == LEFT) { @@ -902,7 +902,13 @@ static int open_stat_pipe(void) if (init) init = 0; else - sleep(1); + /* + * Sleep a bit to avoid a busy loop. As the call to sleep() may + * be interrupted by SIGCHLD, we simply wait until the call + * succeeds. + */ + while (sleep(2)) + ; /* nothing */ ret = para_exec_cmdline_pid(&pid, conf.stat_cmd_arg, fds); if (ret < 0) return ret;