Bug of libcsupport open?

Wei Shen cquark at gmail.com
Sun Aug 24 19:53:40 UTC 2008


Hi,

I made a patch for cpukit/libcsupport/src/open.c.

--- open.c      2008-08-22 14:19:45.000000000 -0700
+++ open.c.new  2008-08-22 14:11:13.000000000 -0700
@@ -194,6 +194,8 @@
       rtems_libio_free( iop );
     if ( loc_to_free )
       rtems_filesystem_freenode( loc_to_free );
+    if ( rc == -1 )
+      return -1;
     rtems_set_errno_and_return_minus_one( rc );
   }


Also append a patch for the mtime and ctime update in
IMFS_memfile_write (I previously posted a reverse patch by mistake).

--- imfs.h      2008-08-22 14:31:37.000000000 -0700
+++ imfs.h.new  2008-08-22 14:28:46.000000000 -0700
@@ -196,12 +196,12 @@
     _jnode->stat_ctime  = (time_t) tv.tv_sec; \
   } while (0)

-#define IMFS_atime_mtime_update( _jnode )   \
+#define IMFS_mtime_ctime_update( _jnode )   \
   do {                                      \
     struct timeval tv;                      \
     gettimeofday( &tv, 0 );                 \
     _jnode->stat_mtime  = (time_t) tv.tv_sec; \
-    _jnode->stat_atime  = (time_t) tv.tv_sec; \
+    _jnode->stat_ctime  = (time_t) tv.tv_sec; \
   } while (0)

 typedef struct {

--- memfile.c   2008-08-22 14:31:18.000000000 -0700
+++ memfile.c.new       2008-08-22 14:30:09.000000000 -0700
@@ -844,7 +844,7 @@
     copied += to_copy;
   }

-  IMFS_atime_mtime_update( the_jnode );
+  IMFS_mtime_ctime_update( the_jnode );

   return copied;
 }


Regards,
Wei



More information about the users mailing list