Kopierer inn denne fila frå pakken
This commit is contained in:
parent
22615506bf
commit
07698b55a8
|
@ -363,6 +363,7 @@ editperm(MYSQL *pmysql, const char *db)
|
||||||
char fn[] = "/tmp/mysql-dbadm.tmp.XXXXXX";
|
char fn[] = "/tmp/mysql-dbadm.tmp.XXXXXX";
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char *editor;
|
char *editor;
|
||||||
|
char *cmd;
|
||||||
char line[1024]; /* buffer to hold one line */
|
char line[1024]; /* buffer to hold one line */
|
||||||
char *cp; /* used to interate through a line */
|
char *cp; /* used to interate through a line */
|
||||||
char *user, *select_priv, *insert_priv, *update_priv, *delete_priv,
|
char *user, *select_priv, *insert_priv, *update_priv, *delete_priv,
|
||||||
|
@ -414,13 +415,15 @@ editperm(MYSQL *pmysql, const char *db)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* exec sh -c '${EDITOR:-pico} "$1"' sh /tmp/filename
|
editor = getenv("EDITOR");
|
||||||
*
|
if (!editor)
|
||||||
* The parameter expansion syntax doesn't work with old bourne
|
editor = "pico"; /* OK since editor won't be freed */
|
||||||
* shells, but it works with newer bourne as well as POSIX shells,
|
|
||||||
* so it should be fine.
|
cmd = malloc(sizeof(char) * strlen(editor) + 7);
|
||||||
*/
|
sprintf(cmd, "%s \"$1\"", editor);
|
||||||
execlp("sh", "sh", "-c", "${EDITOR:-pico} \"$1\"", "sh", fn, NULL);
|
|
||||||
|
/* sh -c '$EDITOR "$1"' sh "$fn" */
|
||||||
|
execlp("sh", "sh", "-c", cmd, "sh", fn, NULL);
|
||||||
perror("Failed to execute editor");
|
perror("Failed to execute editor");
|
||||||
fprintf(stderr, "Make sure the EDITOR environment variable contains"
|
fprintf(stderr, "Make sure the EDITOR environment variable contains"
|
||||||
" a valid editor\n");
|
" a valid editor\n");
|
||||||
|
|
Loading…
Reference in New Issue