source /path/to/rc| (with pipe)
Mads Martin Joergensen <mmj <at> suse.de>
2004-07-01 12:43:41 GMT
Hey Thomas,
It seems that the sanity checks added sometime in the 1.5 series to
check if it's possible to stat an rc file before proceeding did not take
care of the fact that it could be there's a pipe at the end of it.
Here's a patch against 1.5.6:
--- init.c
+++ init.c
<at> <at> -1366,15 +1366,21 <at> <at> static int source_rc (const char *rcfile
int line = 0, rc = 0;
BUFFER token;
char *linebuf = NULL;
+ char *rrcfile = strdup(rcfile);
size_t buflen;
pid_t pid;
struct stat s;
- if (stat (rcfile, &s) < 0)
+ buflen = strlen(rcfile);
+ if (rcfile[buflen-1] == '|')
+ rrcfile[buflen-1] = '\0';
+ if (stat (rrcfile, &s) < 0)
{
- snprintf (err->data, err->dsize, _("%s: stat: %s"), rcfile, strerror (errno));
+ snprintf (err->data, err->dsize, _("%s: stat: %s"), rrcfile, strerror (errno));
+ free(rrcfile);
return (-1);
}
(Continue reading)