FreeBSD Bugzilla – Attachment 190274 Details for
Bug 63197
[patch] tftp(1) Bus error, core dumped
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to usr.bin/tftp/main.c
tftp_main_c_updated.patch (text/plain), 2.53 KB, created by
Fernando Apesteguía
on 2018-02-02 18:51:15 UTC
(
hide
)
Description:
patch to usr.bin/tftp/main.c
Filename:
MIME Type:
Creator:
Fernando Apesteguía
Created:
2018-02-02 18:51:15 UTC
Size:
2.53 KB
patch
obsolete
>Index: main.c >=================================================================== >--- main.c (revisión: 328635) >+++ main.c (copia de trabajo) >@@ -112,7 +112,7 @@ > static void setrollover(int, char **); > static void setpacketdrop(int, char **); > >-static void command(void) __dead2; >+static void command(int, EditLine *, History *, HistEvent *); > static const char *command_prompt(void); > > static void urihandling(char *URI); >@@ -174,11 +174,32 @@ > int > main(int argc, char *argv[]) > { >+ int vrbose; >+ EditLine *el; >+ History *hist; >+ HistEvent he; >+ > > acting_as_client = 1; > peer = -1; > strcpy(mode, "netascii"); > signal(SIGINT, intr); >+ >+ vrbose = isatty(0); >+ el = 0; >+ hist = 0; >+ >+ if (vrbose) { >+ el = el_init("tftp", stdin, stdout, stderr); >+ hist = history_init(); >+ history(hist, &he, H_SETSIZE, 100); >+ el_set(el, EL_HIST, history, hist); >+ el_set(el, EL_EDITOR, "emacs"); >+ el_set(el, EL_PROMPT, command_prompt); >+ el_set(el, EL_SIGNAL, 1); >+ el_source(el, NULL); >+ } >+ > if (argc > 1) { > if (setjmp(toplevel) != 0) > exit(txrx_error); >@@ -190,11 +211,14 @@ > > setpeer(argc, argv); > } >- if (setjmp(toplevel) != 0) >+ if (setjmp(toplevel) != 0) { >+ if (vrbose) { >+ el_reset(el); >+ } > (void)putchar('\n'); >- >+ } > init_options(); >- command(); >+ command(vrbose, el, hist, &he); > } > > /* >@@ -701,36 +725,22 @@ > * Command parser. > */ > static void >-command(void) >+command(int vrbose, EditLine *el, History *hist, HistEvent *hep) > { >- HistEvent he; > struct cmd *c; >- static EditLine *el; >- static History *hist; > const char *bp; > char *cp; >- int len, num, vrbose; >+ int len, num; > char line[MAXLINE]; > >- vrbose = isatty(0); >- if (vrbose) { >- el = el_init("tftp", stdin, stdout, stderr); >- hist = history_init(); >- history(hist, &he, H_SETSIZE, 100); >- el_set(el, EL_HIST, history, hist); >- el_set(el, EL_EDITOR, "emacs"); >- el_set(el, EL_PROMPT, command_prompt); >- el_set(el, EL_SIGNAL, 1); >- el_source(el, NULL); >- } > for (;;) { > if (vrbose) { >- if ((bp = el_gets(el, &num)) == NULL || num == 0) >- exit(0); >- len = MIN(MAXLINE, num); >- memcpy(line, bp, len); >- line[len] = '\0'; >- history(hist, &he, H_ENTER, bp); >+ if ((bp = el_gets(el, &num)) == NULL || num == 0) >+ exit(0); >+ len = (num > MAXLINE) ? MAXLINE : num; >+ memcpy(line, bp, len); >+ line[len] = '\0'; >+ history(hist, hep, H_ENTER, bp); > } else { > line[0] = 0; > if (fgets(line, sizeof line , stdin) == NULL) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 63197
:
40191
| 190274