mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 15:26:23 -05:00
Insure file descriptor is properly closed when doing filename completion.
This commit is contained in:
parent
8502fb66c6
commit
66649313ae
17
input.c
17
input.c
@ -539,6 +539,11 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar)
|
|||||||
mlwrite("");
|
mlwrite("");
|
||||||
TTflush();
|
TTflush();
|
||||||
|
|
||||||
|
if( tmpf != NULL) {
|
||||||
|
fclose( tmpf) ;
|
||||||
|
unlink( tmp) ;
|
||||||
|
}
|
||||||
|
|
||||||
/* if we default the buffer, return FALSE */
|
/* if we default the buffer, return FALSE */
|
||||||
if (buf[0] == 0)
|
if (buf[0] == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -553,6 +558,11 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar)
|
|||||||
/* Abort the input? */
|
/* Abort the input? */
|
||||||
ctrlg(FALSE, 0);
|
ctrlg(FALSE, 0);
|
||||||
TTflush();
|
TTflush();
|
||||||
|
if( tmpf != NULL) {
|
||||||
|
fclose( tmpf) ;
|
||||||
|
unlink( tmp) ;
|
||||||
|
}
|
||||||
|
|
||||||
return ABORT;
|
return ABORT;
|
||||||
} else if ((c == 0x7F || c == 0x08) && quotef == FALSE) {
|
} else if ((c == 0x7F || c == 0x08) && quotef == FALSE) {
|
||||||
/* rubout/erase */
|
/* rubout/erase */
|
||||||
@ -628,8 +638,12 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar)
|
|||||||
if (nskip < 0) {
|
if (nskip < 0) {
|
||||||
buf[ocpos] = 0;
|
buf[ocpos] = 0;
|
||||||
#if UNIX
|
#if UNIX
|
||||||
if (tmpf != NULL)
|
if (tmpf != NULL) {
|
||||||
fclose(tmpf);
|
fclose(tmpf);
|
||||||
|
tmpf = NULL ;
|
||||||
|
unlink( tmp) ;
|
||||||
|
}
|
||||||
|
|
||||||
strcpy(tmp, "/tmp/meXXXXXX");
|
strcpy(tmp, "/tmp/meXXXXXX");
|
||||||
strcpy(ffbuf, "echo ");
|
strcpy(ffbuf, "echo ");
|
||||||
strcat(ffbuf, buf);
|
strcat(ffbuf, buf);
|
||||||
@ -712,7 +726,6 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar)
|
|||||||
TTflush();
|
TTflush();
|
||||||
#if UNIX
|
#if UNIX
|
||||||
rewind(tmpf);
|
rewind(tmpf);
|
||||||
unlink(tmp);
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user