errno needs to be nulled in Linux.
Its previous value will be returned after checking.
This commit is contained in:
parent
04cdfb6bb9
commit
bb23520bd4
|
|
@ -68,7 +68,8 @@ static bool nooptran = TRUE;
|
||||||
void com_optran(wordlist* wl) {
|
void com_optran(wordlist* wl) {
|
||||||
wordlist* wltmp = wl;
|
wordlist* wltmp = wl;
|
||||||
char* stpstr;
|
char* stpstr;
|
||||||
int err, optrancom;
|
int err;
|
||||||
|
long int optrancom;
|
||||||
static bool dataset = FALSE;
|
static bool dataset = FALSE;
|
||||||
static bool getdata = FALSE;
|
static bool getdata = FALSE;
|
||||||
static int opiter = 1;
|
static int opiter = 1;
|
||||||
|
|
@ -96,8 +97,8 @@ void com_optran(wordlist* wl) {
|
||||||
getdata = TRUE;
|
getdata = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int saved = errno;
|
||||||
|
errno = 0;
|
||||||
nooptran = FALSE;
|
nooptran = FALSE;
|
||||||
/* wordlist with 6 parameters */
|
/* wordlist with 6 parameters */
|
||||||
optrancom = strtol(wltmp->wl_word, &stpstr, 10);
|
optrancom = strtol(wltmp->wl_word, &stpstr, 10);
|
||||||
|
|
@ -166,6 +167,8 @@ void com_optran(wordlist* wl) {
|
||||||
goto bugquit;
|
goto bugquit;
|
||||||
}
|
}
|
||||||
dataset = TRUE;
|
dataset = TRUE;
|
||||||
|
if (errno == 0)
|
||||||
|
errno = saved;
|
||||||
return;
|
return;
|
||||||
bugquit:
|
bugquit:
|
||||||
fprintf(stderr, "Error in command 'optran'\n");
|
fprintf(stderr, "Error in command 'optran'\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue