Skip to content
Snippets Groups Projects
Commit 4277f365 authored by David Bigagli's avatar David Bigagli Committed by Morris Jette
Browse files

sacctmgr: terminate sacctmgr on EOF if readline function missing

parent e7a7d483
No related branches found
No related tags found
No related merge requests found
...@@ -256,9 +256,10 @@ static char *_getline(const char *prompt) ...@@ -256,9 +256,10 @@ static char *_getline(const char *prompt)
int len; int len;
printf("%s", prompt); printf("%s", prompt);
/* we only set this here to avoid a warning. We throw it away /* Set "line" here to avoid a warning and discard it away later. */
later. */
line = fgets(buf, 4096, stdin); line = fgets(buf, 4096, stdin);
if (line == NULL)
return NULL;
len = strlen(buf); len = strlen(buf);
if ((len > 0) && (buf[len-1] == '\n')) if ((len > 0) && (buf[len-1] == '\n'))
buf[len-1] = '\0'; buf[len-1] = '\0';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment