From c792262b137a5f2daddac22f82e7d8d98d0d7d31 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Wed, 6 Aug 2014 16:36:00 -0400 Subject: wrap fgets to retry on EINTR The read() underlying fgets() can be interrupted by a signal handler causing fgets() to return NULL. Before we started handling SIGWINCH, the odds of interrupting a read were low and typically resulted in termination anyway. Replace all fgets calls with a wrapper that retries in EINTR. Signed-off-by: Andrew Gregory --- lib/libalpm/trans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libalpm/trans.c') diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 4a176086..aebd8dd2 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -280,7 +280,7 @@ static int grep(const char *fn, const char *needle) } while(!feof(fp)) { char line[1024]; - if(fgets(line, sizeof(line), fp) == NULL) { + if(safe_fgets(line, sizeof(line), fp) == NULL) { continue; } /* TODO: this will not work if the search string -- cgit v1.2.3-24-g4f1b