From 703aa13ff5e2b795319a3e900c1f8df6e3da47b5 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 23 Oct 2006 22:43:02 +0000 Subject: watch: fix warning getty: fix breakage; fix excessive stack usage --- coreutils/watch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'coreutils') diff --git a/coreutils/watch.c b/coreutils/watch.c index e3e9e06..b188b41 100644 --- a/coreutils/watch.c +++ b/coreutils/watch.c @@ -58,8 +58,9 @@ int watch_main(int argc, char **argv) time_t t; get_terminal_width_height(STDOUT_FILENO, &width, 0); + if (width < 1) width = 1; // paranoia header = xrealloc(header, width--); - // We pad with spaces entire length + // '%-*s' pads header with spaces to the full width snprintf(header, width, "Every %ds: %-*s", period, width, cmd); time(&t); thyme = ctime(&t); @@ -75,4 +76,5 @@ int watch_main(int argc, char **argv) system(cmd); sleep(period); } + return 0; // gcc thinks we can reach this :) } -- cgit v1.1