Compare commits

...

2 commits

2 changed files with 8 additions and 6 deletions

View file

@ -806,6 +806,7 @@ static void command(void)
exit(0); /* EOF */ exit(0); /* EOF */
#else #else
fputs(prompt, stdout); fputs(prompt, stdout);
fflush(stdout);
if (fgets(line, LBUFLEN, stdin) == 0) { if (fgets(line, LBUFLEN, stdin) == 0) {
if (feof(stdin)) { if (feof(stdin)) {
exit(0); exit(0);

View file

@ -278,15 +278,16 @@ makerequest(int request, const char *name,
struct tftphdr *tp, const char *mode) struct tftphdr *tp, const char *mode)
{ {
char *cp; char *cp;
size_t len;
tp->th_opcode = htons((u_short) request); tp->th_opcode = htons((u_short) request);
cp = (char *)&(tp->th_stuff); cp = (char *)&(tp->th_stuff);
strcpy(cp, name); len = strlen(name) + 1;
cp += strlen(name); memcpy(cp, name, len);
*cp++ = '\0'; cp += len;
strcpy(cp, mode); len = strlen(mode) + 1;
cp += strlen(mode); memcpy(cp, mode, len);
*cp++ = '\0'; cp += len;
return (cp - (char *)tp); return (cp - (char *)tp);
} }