bring back ${ foo;} sans dot.mkshrc patch, using a temporary file, and as experimental feature
This commit is contained in:
16
main.c
16
main.c
@ -34,7 +34,7 @@
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.232 2012/10/22 16:53:22 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.233 2012/10/22 20:19:14 tg Exp $");
|
||||
|
||||
extern char **environ;
|
||||
|
||||
@ -1377,7 +1377,7 @@ void
|
||||
restfd(int fd, int ofd)
|
||||
{
|
||||
if (fd == 2)
|
||||
shf_flush(&shf_iob[fd]);
|
||||
shf_flush(&shf_iob[/* fd */ 2]);
|
||||
if (ofd < 0)
|
||||
/* original fd closed */
|
||||
close(fd);
|
||||
@ -1591,6 +1591,18 @@ maketemp(Area *ap, Temp_type type, struct temp **tlist)
|
||||
/* do another cycle */
|
||||
}
|
||||
|
||||
#ifndef MKSH_DISABLE_EXPERIMENTAL
|
||||
if (type == TT_FUNSUB) {
|
||||
int nfd;
|
||||
|
||||
/* map us high and mark as close-on-exec */
|
||||
if ((nfd = savefd(i)) != i) {
|
||||
close(i);
|
||||
i = nfd;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* shf_fdopen cannot fail, so no fd leak */
|
||||
tp->shf = shf_fdopen(i, SHF_WR, NULL);
|
||||
|
||||
|
Reference in New Issue
Block a user