change log for rtems (2011-04-04)

rtems-vc at rtems.org rtems-vc at rtems.org
Mon Apr 4 17:10:14 UTC 2011


 *joel*:
2011-04-04	Joel Sherrill <joel.sherrilL at OARcorp.com>

	PR 1773/cpukit
	* sapi/include/confdefs.h, sapi/src/exinit.c,
	score/include/rtems/bspsmp.h, score/src/percpu.c, score/src/thread.c:
	Rename rtems_smp_maximum_processor to
	rtems_configuration_smp_maximum_processor. Eliminate printk().

M 1.2793  cpukit/ChangeLog
M  1.162  cpukit/sapi/include/confdefs.h
M   1.58  cpukit/sapi/src/exinit.c
M    1.2  cpukit/score/include/rtems/bspsmp.h
M    1.4  cpukit/score/src/percpu.c
M   1.68  cpukit/score/src/thread.c

diff -u rtems/cpukit/ChangeLog:1.2792 rtems/cpukit/ChangeLog:1.2793
--- rtems/cpukit/ChangeLog:1.2792	Thu Mar 24 06:21:57 2011
+++ rtems/cpukit/ChangeLog	Mon Apr  4 11:39:58 2011
@@ -1,3 +1,11 @@
+2011-04-04	Joel Sherrill <joel.sherrilL at OARcorp.com>
+
+	PR 1773/cpukit
+	* sapi/include/confdefs.h, sapi/src/exinit.c,
+	score/include/rtems/bspsmp.h, score/src/percpu.c, score/src/thread.c:
+	Rename rtems_smp_maximum_processor to
+	rtems_configuration_smp_maximum_processor. Eliminate printk().
+
 2011-03-24	Ralf Corsépius <ralf.corsepius at rtems.org>
 
 	* include/rtems/bsd/sys/queue.h, include/rtems/bsd/sys/cdefs.h:

diff -u rtems/cpukit/sapi/include/confdefs.h:1.161 rtems/cpukit/sapi/include/confdefs.h:1.162
--- rtems/cpukit/sapi/include/confdefs.h:1.161	Wed Mar 16 15:05:04 2011
+++ rtems/cpukit/sapi/include/confdefs.h	Mon Apr  4 11:40:00 2011
@@ -2161,9 +2161,10 @@
    *  in an SMP configuration.
    */
   #if defined(CONFIGURE_INIT)
-    uint32_t rtems_smp_maximum_processors = CONFIGURE_SMP_MAXIMUM_PROCESSORS;
+    uint32_t rtems_configuration_smp_maximum_processors = \
+        CONFIGURE_SMP_MAXIMUM_PROCESSORS;
   #else
-    extern uint32_t rtems_smp_maximum_processors;
+    extern uint32_t rtems_configuration_smp_maximum_processors;
   #endif
  /*
   * Instantiate the Per CPU information based upon the user configuration.

diff -u rtems/cpukit/sapi/src/exinit.c:1.57 rtems/cpukit/sapi/src/exinit.c:1.58
--- rtems/cpukit/sapi/src/exinit.c:1.57	Wed Mar 16 15:05:04 2011
+++ rtems/cpukit/sapi/src/exinit.c	Mon Apr  4 11:40:00 2011
@@ -163,7 +163,8 @@
    * Discover and initialize the secondary cores in an SMP system.
    */
   #if defined(RTEMS_SMP)
-    _SMP_Processor_count = bsp_smp_initialize( rtems_smp_maximum_processors );
+    _SMP_Processor_count =
+        bsp_smp_initialize( rtems_configuration_smp_maximum_processors );
   #endif
 
   _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );

diff -u rtems/cpukit/score/include/rtems/bspsmp.h:1.1 rtems/cpukit/score/include/rtems/bspsmp.h:1.2
--- rtems/cpukit/score/include/rtems/bspsmp.h:1.1	Wed Mar 16 15:05:05 2011
+++ rtems/cpukit/score/include/rtems/bspsmp.h	Mon Apr  4 11:40:00 2011
@@ -87,7 +87,7 @@
  *  This variable is set during the SMP initialization sequence to
  *  indicate the Maximum number of CPUs in this system.
  */
-extern uint32_t rtems_smp_maximum_processors;
+extern uint32_t rtems_configuration_smp_maximum_processors;
  
 /**
  *  @brief Initialize Secondary CPUs

diff -u rtems/cpukit/score/src/percpu.c:1.3 rtems/cpukit/score/src/percpu.c:1.4
--- rtems/cpukit/score/src/percpu.c:1.3	Fri Mar 18 09:12:46 2011
+++ rtems/cpukit/score/src/percpu.c	Mon Apr  4 11:40:00 2011
@@ -40,9 +40,7 @@
      */
     size = Configuration.interrupt_stack_size;
     _Per_CPU_Information_p[0] = &_Per_CPU_Information[0];
-    for (cpu=1 ; cpu < rtems_smp_maximum_processors; cpu++ ) {
-
-      printk("Initializing cpu control structure %d\n", cpu );
+    for (cpu=1 ; cpu < rtems_configuration_smp_maximum_processors; cpu++ ) {
 
       Per_CPU_Control *p = &_Per_CPU_Information[cpu];
 

diff -u rtems/cpukit/score/src/thread.c:1.67 rtems/cpukit/score/src/thread.c:1.68
--- rtems/cpukit/score/src/thread.c:1.67	Wed Mar 16 15:05:06 2011
+++ rtems/cpukit/score/src/thread.c	Mon Apr  4 11:40:00 2011
@@ -94,7 +94,7 @@
    *  coupled multiprocessing system, account for the MPCI Server Thread.
    */
   #if defined(RTEMS_SMP)
-    maximum_internal_threads = rtems_smp_maximum_processors;
+    maximum_internal_threads = rtems_configuration_smp_maximum_processors;
   #else
     maximum_internal_threads = 1;
   #endif


 *joel* (on branch rtems-4-10-branch):
2011-04-04	Joel Sherrill <joel.sherrilL at OARcorp.com>

	PR 1768/bsps
	* shared/irq/irq_asm.S: The nbench benchmark highlighted the fact that
	we do not perform a cld before calling C code in the ISR. This was
	historically not a problem but gcc 4.3 changed the behavior. From
	http://gcc.gnu.org/gcc-4.3/changes.html

M   1.78  c/src/lib/libbsp/i386/ChangeLog
M 1.47.2.3  c/src/lib/libbsp/i386/ChangeLog
M 1.64.2.2  c/src/lib/libbsp/i386/ChangeLog
M   1.24  c/src/lib/libbsp/i386/shared/irq/irq_asm.S
M 1.8.6.3  c/src/lib/libbsp/i386/shared/irq/irq_asm.S
M 1.16.2.1  c/src/lib/libbsp/i386/shared/irq/irq_asm.S

diff -u rtems/c/src/lib/libbsp/i386/ChangeLog:1.77 rtems/c/src/lib/libbsp/i386/ChangeLog:1.78
--- rtems/c/src/lib/libbsp/i386/ChangeLog:1.77	Wed Mar 16 15:05:17 2011
+++ rtems/c/src/lib/libbsp/i386/ChangeLog	Mon Apr  4 11:44:46 2011
@@ -1,3 +1,11 @@
+2011-04-04	Joel Sherrill <joel.sherrilL at OARcorp.com>
+
+	PR 1768/bsps
+	* shared/irq/irq_asm.S: The nbench benchmark highlighted the fact that
+	we do not perform a cld before calling C code in the ISR. This was
+	historically not a problem but gcc 4.3 changed the behavior. From
+	http://gcc.gnu.org/gcc-4.3/changes.html
+
 2011-03-16	Jennifer Averett <jennifer.averett at OARcorp.com>
 
 	PR 1729/cpukit

diff -u rtems/c/src/lib/libbsp/i386/ChangeLog:1.47.2.2 rtems/c/src/lib/libbsp/i386/ChangeLog:1.47.2.3
--- rtems/c/src/lib/libbsp/i386/ChangeLog:1.47.2.2	Mon May 18 12:45:21 2009
+++ rtems/c/src/lib/libbsp/i386/ChangeLog	Mon Apr  4 11:45:01 2011
@@ -1,3 +1,11 @@
+2011-04-04	Joel Sherrill <joel.sherrilL at OARcorp.com>
+
+	PR 1768/bsps
+	* shared/irq/irq_asm.S: The nbench benchmark highlighted the fact that
+	we do not perform a cld before calling C code in the ISR. This was
+	historically not a problem but gcc 4.3 changed the behavior. From
+	http://gcc.gnu.org/gcc-4.3/changes.html
+
 2009-05-18	Joel Sherrill <joel.sherrill at OARcorp.com>
 
 	* shared/irq/irq.c, shared/irq/irq.h, shared/irq/irq_asm.S: Add shared

diff -u rtems/c/src/lib/libbsp/i386/ChangeLog:1.64.2.1 rtems/c/src/lib/libbsp/i386/ChangeLog:1.64.2.2
--- rtems/c/src/lib/libbsp/i386/ChangeLog:1.64.2.1	Wed Feb  2 09:14:30 2011
+++ rtems/c/src/lib/libbsp/i386/ChangeLog	Mon Apr  4 11:44:55 2011
@@ -1,3 +1,11 @@
+2011-04-04	Joel Sherrill <joel.sherrilL at OARcorp.com>
+
+	PR 1768/bsps
+	* shared/irq/irq_asm.S: The nbench benchmark highlighted the fact that
+	we do not perform a cld before calling C code in the ISR. This was
+	historically not a problem but gcc 4.3 changed the behavior. From
+	http://gcc.gnu.org/gcc-4.3/changes.html
+
 2011-02-02	Ralf Corsépius <ralf.corsepius at rtems.org>
 
 	* configure.ac: Require autoconf-2.68, automake-1.11.1.

diff -u rtems/c/src/lib/libbsp/i386/shared/irq/irq_asm.S:1.23 rtems/c/src/lib/libbsp/i386/shared/irq/irq_asm.S:1.24
--- rtems/c/src/lib/libbsp/i386/shared/irq/irq_asm.S:1.23	Wed Mar 16 15:05:17 2011
+++ rtems/c/src/lib/libbsp/i386/shared/irq/irq_asm.S	Mon Apr  4 11:44:46 2011
@@ -167,6 +167,13 @@
 	incl      PER_CPU_ISR_NEST_LEVEL(ebx)  /* one nest level deeper */
 	incl      SYM (_Thread_Dispatch_disable_level) /* disable multitasking */
 
+        /*
+         * GCC versions starting with 4.3 no longer place the cld
+         * instruction before string operations.  We  need to ensure
+         * it is set correctly for ISR handlers.
+         */
+        cld
+
 	/*
 	 * re-enable interrupts at processor level as the current
 	 * interrupt source is now masked via i8259

diff -u rtems/c/src/lib/libbsp/i386/shared/irq/irq_asm.S:1.8.6.2 rtems/c/src/lib/libbsp/i386/shared/irq/irq_asm.S:1.8.6.3
--- rtems/c/src/lib/libbsp/i386/shared/irq/irq_asm.S:1.8.6.2	Mon May 18 12:45:21 2009
+++ rtems/c/src/lib/libbsp/i386/shared/irq/irq_asm.S	Mon Apr  4 11:45:01 2011
@@ -121,6 +121,13 @@
 	movl	  ebp, esp
 	popl	  ebp
 
+        /*
+         * GCC versions starting with 4.3 no longer place the cld
+         * instruction before string operations.  We  need to ensure
+         * it is set correctly for ISR handlers.
+         */
+        cld
+
 	/*
 	 * restore the original i8259 masks
 	 */

diff -u rtems/c/src/lib/libbsp/i386/shared/irq/irq_asm.S:1.16 rtems/c/src/lib/libbsp/i386/shared/irq/irq_asm.S:1.16.2.1
--- rtems/c/src/lib/libbsp/i386/shared/irq/irq_asm.S:1.16	Sun Nov 29 21:47:10 2009
+++ rtems/c/src/lib/libbsp/i386/shared/irq/irq_asm.S	Mon Apr  4 11:44:55 2011
@@ -145,6 +145,13 @@
 	incl      SYM (_ISR_Nest_level)     /* one nest level deeper */
 	incl      SYM (_Thread_Dispatch_disable_level) /* disable multitasking */
 
+        /*
+         * GCC versions starting with 4.3 no longer place the cld
+         * instruction before string operations.  We  need to ensure
+         * it is set correctly for ISR handlers.
+         */
+        cld
+
 	/*
 	 * re-enable interrupts at processor level as the current
 	 * interrupt source is now masked via i8259


 *joel* (on branch rtems-4-10-branch):
2011-04-04	Sebastien Bourdeauducq <sebastien.bourdeauducq at gmail.com>

	PR 1722/networking
	* ftpd/ftpd.c: FTPD fails to parse correctly FTP commands relating to
	filenames with spaces in them.

M 1.2794  cpukit/ChangeLog
M 1.1539.2.73  cpukit/ChangeLog
M 1.2346.2.85  cpukit/ChangeLog
M   1.24  cpukit/ftpd/ftpd.c
M 1.18.2.2  cpukit/ftpd/ftpd.c
M 1.23.2.1  cpukit/ftpd/ftpd.c

diff -u rtems/cpukit/ChangeLog:1.2793 rtems/cpukit/ChangeLog:1.2794
--- rtems/cpukit/ChangeLog:1.2793	Mon Apr  4 11:39:58 2011
+++ rtems/cpukit/ChangeLog	Mon Apr  4 12:08:34 2011
@@ -1,3 +1,9 @@
+2011-04-04	Sebastien Bourdeauducq <sebastien.bourdeauducq at gmail.com>
+
+	PR 1722/networking
+	* ftpd/ftpd.c: FTPD fails to parse correctly FTP commands relating to
+	filenames with spaces in them.
+
 2011-04-04	Joel Sherrill <joel.sherrilL at OARcorp.com>
 
 	PR 1773/cpukit

diff -u rtems/cpukit/ChangeLog:1.1539.2.72 rtems/cpukit/ChangeLog:1.1539.2.73
--- rtems/cpukit/ChangeLog:1.1539.2.72	Tue Mar  8 16:15:05 2011
+++ rtems/cpukit/ChangeLog	Mon Apr  4 12:08:57 2011
@@ -1,3 +1,9 @@
+2011-04-04	Sebastien Bourdeauducq <sebastien.bourdeauducq at gmail.com>
+
+	PR 1722/networking
+	* ftpd/ftpd.c: FTPD fails to parse correctly FTP commands relating to
+	filenames with spaces in them.
+
 2011-03-08	Joel Sherrill <joel.sherrilL at OARcorp.com>
 
 	PR 1759/cpukit

diff -u rtems/cpukit/ChangeLog:1.2346.2.84 rtems/cpukit/ChangeLog:1.2346.2.85
--- rtems/cpukit/ChangeLog:1.2346.2.84	Mon Mar 14 02:44:32 2011
+++ rtems/cpukit/ChangeLog	Mon Apr  4 12:08:45 2011
@@ -1,3 +1,9 @@
+2011-04-04	Sebastien Bourdeauducq <sebastien.bourdeauducq at gmail.com>
+
+	PR 1722/networking
+	* ftpd/ftpd.c: FTPD fails to parse correctly FTP commands relating to
+	filenames with spaces in them.
+
 2011-03-14	Chris Johns <chrisj at rtems.org>
 
 	PR 1757/filesystem

diff -u rtems/cpukit/ftpd/ftpd.c:1.23 rtems/cpukit/ftpd/ftpd.c:1.24
--- rtems/cpukit/ftpd/ftpd.c:1.23	Fri May  7 04:07:17 2010
+++ rtems/cpukit/ftpd/ftpd.c	Mon Apr  4 12:08:34 2011
@@ -15,6 +15,10 @@
  *
  *  Changes:
  *
+ *    2010-12-02        Sebastien Bourdeauducq <sebastien at milkymist.org>
+ *
+ *      * Support spaces in filenames
+ * 
  *    2001-01-31        Sergei Organov <osv at javad.ru>
  *
  *      * Hacks with current dir and root dir removed in favor of new libio
@@ -1680,27 +1684,27 @@
   }
   else if (!strcmp("RETR", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_retrieve(info, fname);
   }
   else if (!strcmp("STOR", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_store(info, fname);
   }
   else if (!strcmp("LIST", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_list(info, fname, 1);
   }
   else if (!strcmp("NLST", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_list(info, fname, 0);
   }
   else if (!strcmp("MDTM", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_mdtm(info, fname);
   }
   else if (!strcmp("SYST", cmd))
@@ -1736,7 +1740,7 @@
       send_reply(info, 550, "Access denied.");
     }
     else if (
-      1 == sscanf(args, "%254s", fname) &&
+      strncpy(fname, args, 254) &&
       unlink(fname) == 0)
     {
       send_reply(info, 257, "DELE successful.");
@@ -1758,15 +1762,14 @@
       {
         send_reply(info, 550, "Access denied.");
       }
-      else if(
-        2 == sscanf(args, "%o %254s", &mask, fname) &&
-        chmod(fname, (mode_t)mask) == 0)
-      {
-        send_reply(info, 257, "CHMOD successful.");
-      }
-      else
-      {
-        send_reply(info, 550, "CHMOD failed.");
+      else {
+        char *c;
+        c = strchr(args, ' ');
+        if((c != NULL) && (sscanf(args, "%o", &mask) == 1) && strncpy(fname, c+1, 254) 
+          && (chmod(fname, (mode_t)mask) == 0))
+          send_reply(info, 257, "CHMOD successful.");
+        else
+          send_reply(info, 550, "CHMOD failed.");
       }
     }
     else
@@ -1779,7 +1782,7 @@
       send_reply(info, 550, "Access denied.");
     }
     else if (
-      1 == sscanf(args, "%254s", fname) &&
+      strncpy(fname, args, 254) &&
       rmdir(fname) == 0)
     {
       send_reply(info, 257, "RMD successful.");
@@ -1796,7 +1799,7 @@
       send_reply(info, 550, "Access denied.");
     }
     else if (
-      1 == sscanf(args, "%254s", fname) &&
+      strncpy(fname, args, 254) &&
       mkdir(fname, S_IRWXU | S_IRWXG | S_IRWXO) == 0)
     {
       send_reply(info, 257, "MKD successful.");
@@ -1808,7 +1811,7 @@
   }
   else if (!strcmp("CWD", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_cwd(info, fname);
   }
   else if (!strcmp("CDUP", cmd))

diff -u rtems/cpukit/ftpd/ftpd.c:1.18.2.1 rtems/cpukit/ftpd/ftpd.c:1.18.2.2
--- rtems/cpukit/ftpd/ftpd.c:1.18.2.1	Wed Feb  4 23:22:38 2009
+++ rtems/cpukit/ftpd/ftpd.c	Mon Apr  4 12:08:59 2011
@@ -15,6 +15,10 @@
  *
  *  Changes:
  *
+ *    2010-12-02        Sebastien Bourdeauducq <sebastien at milkymist.org>
+ *
+ *      * Support spaces in filenames
+ * 
  *    2001-01-31        Sergei Organov <osv at javad.ru>
  *
  *      * Hacks with current dir and root dir removed in favor of new libio
@@ -1671,27 +1675,27 @@
   }
   else if (!strcmp("RETR", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_retrieve(info, fname);
   }
   else if (!strcmp("STOR", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_store(info, fname);
   }
   else if (!strcmp("LIST", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_list(info, fname, 1);
   }
   else if (!strcmp("NLST", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_list(info, fname, 0);
   }
   else if (!strcmp("MDTM", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_mdtm(info, fname);
   }
   else if (!strcmp("SYST", cmd))
@@ -1727,7 +1731,7 @@
       send_reply(info, 550, "Access denied.");
     }
     else if (
-      1 == sscanf(args, "%254s", fname) &&
+      strncpy(fname, args, 254) &&
       unlink(fname) == 0)
     {
       send_reply(info, 257, "DELE successful.");
@@ -1749,15 +1753,14 @@
       {
         send_reply(info, 550, "Access denied.");
       }
-      else if(
-        2 == sscanf(args, "%o %254s", &mask, fname) &&
-        chmod(fname, (mode_t)mask) == 0)
-      {
-        send_reply(info, 257, "CHMOD successful.");
-      }
-      else
-      {
-        send_reply(info, 550, "CHMOD failed.");
+      else {
+        char *c;
+        c = strchr(args, ' ');
+        if((c != NULL) && (sscanf(args, "%o", &mask) == 1) && strncpy(fname, c+1, 254) 
+          && (chmod(fname, (mode_t)mask) == 0))
+          send_reply(info, 257, "CHMOD successful.");
+        else
+          send_reply(info, 550, "CHMOD failed.");
       }
     }
     else
@@ -1770,7 +1773,7 @@
       send_reply(info, 550, "Access denied.");
     }
     else if (
-      1 == sscanf(args, "%254s", fname) &&
+      strncpy(fname, args, 254) &&
       rmdir(fname) == 0)
     {
       send_reply(info, 257, "RMD successful.");
@@ -1787,7 +1790,7 @@
       send_reply(info, 550, "Access denied.");
     }
     else if (
-      1 == sscanf(args, "%254s", fname) &&
+      strncpy(fname, args, 254) &&
       mkdir(fname, S_IRWXU | S_IRWXG | S_IRWXO) == 0)
     {
       send_reply(info, 257, "MKD successful.");
@@ -1799,7 +1802,7 @@
   }
   else if (!strcmp("CWD", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_cwd(info, fname);
   }
   else if (!strcmp("CDUP", cmd))

diff -u rtems/cpukit/ftpd/ftpd.c:1.23 rtems/cpukit/ftpd/ftpd.c:1.23.2.1
--- rtems/cpukit/ftpd/ftpd.c:1.23	Fri May  7 04:07:17 2010
+++ rtems/cpukit/ftpd/ftpd.c	Mon Apr  4 12:08:47 2011
@@ -15,6 +15,10 @@
  *
  *  Changes:
  *
+ *    2010-12-02        Sebastien Bourdeauducq <sebastien at milkymist.org>
+ *
+ *      * Support spaces in filenames
+ * 
  *    2001-01-31        Sergei Organov <osv at javad.ru>
  *
  *      * Hacks with current dir and root dir removed in favor of new libio
@@ -1680,27 +1684,27 @@
   }
   else if (!strcmp("RETR", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_retrieve(info, fname);
   }
   else if (!strcmp("STOR", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_store(info, fname);
   }
   else if (!strcmp("LIST", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_list(info, fname, 1);
   }
   else if (!strcmp("NLST", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_list(info, fname, 0);
   }
   else if (!strcmp("MDTM", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_mdtm(info, fname);
   }
   else if (!strcmp("SYST", cmd))
@@ -1736,7 +1740,7 @@
       send_reply(info, 550, "Access denied.");
     }
     else if (
-      1 == sscanf(args, "%254s", fname) &&
+      strncpy(fname, args, 254) &&
       unlink(fname) == 0)
     {
       send_reply(info, 257, "DELE successful.");
@@ -1758,15 +1762,14 @@
       {
         send_reply(info, 550, "Access denied.");
       }
-      else if(
-        2 == sscanf(args, "%o %254s", &mask, fname) &&
-        chmod(fname, (mode_t)mask) == 0)
-      {
-        send_reply(info, 257, "CHMOD successful.");
-      }
-      else
-      {
-        send_reply(info, 550, "CHMOD failed.");
+      else {
+        char *c;
+        c = strchr(args, ' ');
+        if((c != NULL) && (sscanf(args, "%o", &mask) == 1) && strncpy(fname, c+1, 254) 
+          && (chmod(fname, (mode_t)mask) == 0))
+          send_reply(info, 257, "CHMOD successful.");
+        else
+          send_reply(info, 550, "CHMOD failed.");
       }
     }
     else
@@ -1779,7 +1782,7 @@
       send_reply(info, 550, "Access denied.");
     }
     else if (
-      1 == sscanf(args, "%254s", fname) &&
+      strncpy(fname, args, 254) &&
       rmdir(fname) == 0)
     {
       send_reply(info, 257, "RMD successful.");
@@ -1796,7 +1799,7 @@
       send_reply(info, 550, "Access denied.");
     }
     else if (
-      1 == sscanf(args, "%254s", fname) &&
+      strncpy(fname, args, 254) &&
       mkdir(fname, S_IRWXU | S_IRWXG | S_IRWXO) == 0)
     {
       send_reply(info, 257, "MKD successful.");
@@ -1808,7 +1811,7 @@
   }
   else if (!strcmp("CWD", cmd))
   {
-    sscanf(args, "%254s", fname);
+    strncpy(fname, args, 254);
     command_cwd(info, fname);
   }
   else if (!strcmp("CDUP", cmd))



--

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/20110404/fecc615d/attachment.html>


More information about the vc mailing list