[BusyBox] Small patch for tftp
Jeff Studer
jstuder at aquilagroup.com
Fri Feb 15 10:27:05 UTC 2002
Hello list,
I was using the busybox tftp and got some vague errors. Turns out, when
I did a 'get' I neglected to give the local filename. Typically, in a
get request, I would use the same localfilename as remotefilename, and
vice-versa for a put. So, out of my own convenience I made a mod that
would, only by default, the original commandline operations work fine,
for a get, set local filename to remote filename, and for a put, set
local filename to remote filename. The -r -l commandline operations
override this.
Obviously this isn't any sort of requirement, just more intuitive to
myself. I thought others might find it convenient as well. Use it or
not.
Heres the patch:
diff -urN busybox-0.60.2.orig/tftp.c busybox-0.60.2/tftp.c
--- busybox-0.60.2.orig/tftp.c Thu Feb 14 12:34:02 2002
+++ busybox-0.60.2/tftp.c Thu Feb 14 12:08:55 2002
@@ -358,6 +358,14 @@
show_usage();
}
+ if(cmd == tftp_cmd_get)
+ if(localfile == NULL)
+ localfile = xstrdup(remotefile);
+
+ if(cmd == tftp_cmd_put)
+ if(remotefile == NULL)
+ remotefile = xstrdup(localfile);
+
fd = open(localfile, flags, 0644);
if (fd < 0) {
perror_msg_and_die("local file");
--
Jeff Studer
Software Engineer
Aquila Technologies Group
jstuder at aquilagroup.com
office: 505-796-3859
More information about the busybox
mailing list