diff options
author | jkar8572 <jkar8572> | 2004-01-07 15:15:31 +0000 |
---|---|---|
committer | jkar8572 <jkar8572> | 2004-01-07 15:15:31 +0000 |
commit | de63cc7548b8f9a53b17ebbdd6a5c077de926517 (patch) | |
tree | 8fae0d7188ec8395c5cb38c4e5766478a7f961f3 | |
parent | b8d851f6a89ed3ab64ca70cf2b71637478605db2 (diff) |
edquota(8) now allows parameters in VISUAL/EDITOR env. params (Jan Kara)
-rw-r--r-- | Changelog | 1 | ||||
-rw-r--r-- | quotaops.c | 30 |
2 files changed, 26 insertions, 5 deletions
@@ -9,6 +9,7 @@ Changes in quota-tools form 3.10 to 3.11 * warnquota(8) can get mail addresses via LDAP (James Bourne) * warnquota(8) can avoid sending e-mail when user is over quota on mail partition (James Bourne) * fixed bug in quotacheck(8) which counted directories twice sometimes (Jan Kara) +* edquota(8) now allows parameters in VISUAL/EDITOR env. params (Jan Kara) Changes in quota-tools from 3.09 to 3.10 * alternative port can be specified to rpc.rquotad by -p option (Jan Kara) @@ -34,7 +34,7 @@ #ident "$Copyright: (c) 1980, 1990 Regents of the University of California. $" #ident "$Copyright: All rights reserved. $" -#ident "$Id: quotaops.c,v 1.10 2003/10/18 17:32:49 jkar8572 Exp $" +#ident "$Id: quotaops.c,v 1.11 2004/01/07 15:15:31 jkar8572 Exp $" #include <rpc/rpc.h> #include <sys/types.h> @@ -172,6 +172,7 @@ int putprivs(struct dquot *qlist, int flags) /* * Take a list of priviledges and get it edited. */ +#define MAX_ED_PARS 128 int editprivs(char *tmpfile) { sigset_t omask, nmask; @@ -188,15 +189,34 @@ int editprivs(char *tmpfile) return -1; } if (pid == 0) { - char *ed; + char *ed, *actp, *nextp; + char *edpars[MAX_ED_PARS]; + int i; sigprocmask(SIG_SETMASK, &omask, NULL); setgid(getgid()); setuid(getuid()); - if ((ed = getenv("VISUAL")) == (char *)0) - if ((ed = getenv("EDITOR")) == (char *)0) + if (!(ed = getenv("VISUAL"))) + if (!(ed = getenv("EDITOR"))) ed = _PATH_VI; - execlp(ed, ed, tmpfile, 0); + i = 0; + ed = actp = sstrdup(ed); + while (actp) { + nextp = strchr(actp, ' '); + if (nextp) { + *nextp = 0; + nextp++; + } + edpars[i++] = actp; + if (i == MAX_ED_PARS-2) { + errstr(_("Too many parameters to editor.\n")); + break; + } + actp = nextp; + } + edpars[i++] = tmpfile; + edpars[i] = NULL; + execvp(edpars[0], edpars); die(1, _("Can't exec %s\n"), ed); } waitpid(pid, &stat, 0); |