change log for rtems (2011-02-21)
rtems-vc at rtems.org
rtems-vc at rtems.org
Mon Feb 21 11:10:26 UTC 2011
*sh*:
2011-02-21 Sebastian Huber <sebastian.huber at embedded-brains.de>
* libnetworking/lib/ftpfs.c: Workaround for some firewalls.
M 1.2720 cpukit/ChangeLog
M 1.36 cpukit/libnetworking/lib/ftpfs.c
diff -u rtems/cpukit/ChangeLog:1.2719 rtems/cpukit/ChangeLog:1.2720
--- rtems/cpukit/ChangeLog:1.2719 Fri Feb 18 09:12:43 2011
+++ rtems/cpukit/ChangeLog Mon Feb 21 04:58:14 2011
@@ -1,3 +1,7 @@
+2011-02-21 Sebastian Huber <sebastian.huber at embedded-brains.de>
+
+ * libnetworking/lib/ftpfs.c: Workaround for some firewalls.
+
2011-02-18 Joel Sherrill <joel.sherrill at oarcorp.com>
* sapi/include/confdefs.h, score/Makefile.am,
diff -u rtems/cpukit/libnetworking/lib/ftpfs.c:1.35 rtems/cpukit/libnetworking/lib/ftpfs.c:1.36
--- rtems/cpukit/libnetworking/lib/ftpfs.c:1.35 Tue Oct 19 04:16:20 2010
+++ rtems/cpukit/libnetworking/lib/ftpfs.c Mon Feb 21 04:58:15 2011
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2009, 2010
+ * Copyright (c) 2009, 2010, 2011
* embedded brains GmbH
* Obere Lagerstr. 30
* D-82178 Puchheim
@@ -347,40 +347,37 @@
bool verbose
)
{
- const char *const eol = "\r\n";
- int rv = 0;
-
- /* Send command */
- rv = send(socket, cmd, strlen(cmd), 0);
- if (rv < 0) {
- return RTEMS_FTPFS_REPLY_ERROR;
- }
- if (verbose) {
- write(STDERR_FILENO, cmd, strlen(cmd));
- }
+ rtems_ftpfs_reply reply = RTEMS_FTPFS_REPLY_ERROR;
+ size_t cmd_len = strlen(cmd);
+ size_t arg_len = arg != NULL ? strlen(arg) : 0;
+ size_t len = cmd_len + arg_len + 2;
+ char *buf = malloc(len);
+
+ if (buf != NULL) {
+ ssize_t n = 0;
+ char *buf_arg = buf + cmd_len;
+ char *buf_eol = buf_arg + arg_len;
+
+ memcpy(buf, cmd, cmd_len);
+ memcpy(buf_arg, arg, arg_len);
+ buf_eol [0] = '\r';
+ buf_eol [1] = '\n';
+
+ /* Send */
+ n = send(socket, buf, len, 0);
+ if (n == (ssize_t) len) {
+ if (verbose) {
+ write(STDERR_FILENO, buf, len);
+ }
- /* Send command argument if necessary */
- if (arg != NULL) {
- rv = send(socket, arg, strlen(arg), 0);
- if (rv < 0) {
- return RTEMS_FTPFS_REPLY_ERROR;
- }
- if (verbose) {
- write(STDERR_FILENO, arg, strlen(arg));
+ /* Reply */
+ reply = rtems_ftpfs_get_reply(socket, parser, parser_arg, verbose);
}
- }
- /* Send end of line */
- rv = send(socket, eol, 2, 0);
- if (rv < 0) {
- return RTEMS_FTPFS_REPLY_ERROR;
- }
- if (verbose) {
- write(STDERR_FILENO, &eol [1], 1);
+ free(buf);
}
- /* Return reply */
- return rtems_ftpfs_get_reply(socket, parser, parser_arg, verbose);
+ return reply;
}
static rtems_ftpfs_reply rtems_ftpfs_send_command(
--
Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110221/31565baa/attachment.html>
More information about the vc
mailing list