TFTP write() in 4.5.0 [PATCH]
Vyacheslav V. Burdjanadze
wr at zelax.ru
Mon Jun 3 16:28:05 UTC 2002
This patch enables tftp write operation (at least) for rtems-4.5.0
release. This is actually slighty modifyed v1.20 if tftpDriver.c under
libnetworking/lib. I did it because I need it in my work that is based
on 4.5.0 release and I have not time to wait for next release. May be
someone got the same problems. So:
1. Get libnetworking/lib/tftpDriver.c v1.20
2. Apply following patch
--- 1/tftpDriver.c Wed Jan 16 17:50:04 2002
+++ tftpDriver.c Mon Jun 3 12:11:40 2002
@@ -15,6 +15,8 @@
*
*/
+#define COMPAT_450
+
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -24,18 +26,26 @@
#include <fcntl.h>
#include <rtems.h>
#include <rtems/libio.h>
+#ifndef COMPAT_450
#include <rtems/libio_.h>
#include <rtems/seterr.h>
+#endif
#include <rtems/rtems_bsdnet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+
#ifdef RTEMS_TFTP_DRIVER_DEBUG
int rtems_tftp_driver_debug = 1;
#endif
+#ifdef COMPAT_450
+#define rtems_set_errno_and_return_minus_one(X) \
+ do {errno = X; return -1; } while( 0 );
+#endif
+
/*
* Range of UDP ports to try
*/
@@ -756,7 +766,11 @@
unsigned32 mode
)
{
+#ifdef COMPAT_450
+ char full_path_name[256];
+#else
char *full_path_name;
+#endif
char *s1;
int err;
@@ -774,6 +788,9 @@
new_name += len;
s1 = "";
}
+#ifdef COMPAT_450
+ strncpy (full_path_name, new_name, sizeof(full_path_name));
+#else
else {
s1 = rtems_filesystem_current.node_access;
}
@@ -782,9 +799,12 @@
return ENOMEM;
strcpy (full_path_name, s1);
strcat (full_path_name, new_name);
+#endif
fixPath (full_path_name);
err = rtems_tftp_open_worker (iop, full_path_name, flags, mode);
+#ifndef COMPAT_450
free (full_path_name);
+#endif
return err;
}
--
- " Why do you call this software 'beta' ? "
- " Cuz it beta than nothin' ! "
More information about the users
mailing list