Ticket #1368: msdos_date.patch

File msdos_date.patch, 2.3 KB (added by sgielis, on 02/04/09 at 11:34:39)

Patch to fix the file creation date bug

Line 
1Index: cpukit/libfs/src/dosfs/msdos_create.c
2===================================================================
3RCS file: /usr1/CVS/rtems/cpukit/libfs/src/dosfs/msdos_create.c,v
4retrieving revision 1.13
5diff -c -3 -p -r1.13 msdos_create.c
6*** cpukit/libfs/src/dosfs/msdos_create.c       29 Jul 2008 02:21:14 -0000      1.13
7--- cpukit/libfs/src/dosfs/msdos_create.c       4 Feb 2009 11:01:40 -0000
8*************** msdos_creat_node(
9*** 85,91 ****
10      if ( time_ret == -1 )
11          return -1;
12 
13!     msdos_date_unix2dos(time_ret, &time_val, &date);
14      *MSDOS_DIR_WRITE_TIME(new_node) = CT_LE_W(time_val);
15      *MSDOS_DIR_WRITE_DATE(new_node) = CT_LE_W(date);
16 
17--- 85,91 ----
18      if ( time_ret == -1 )
19          return -1;
20 
21!     msdos_date_unix2dos(time_ret, &date, &time_val);
22      *MSDOS_DIR_WRITE_TIME(new_node) = CT_LE_W(time_val);
23      *MSDOS_DIR_WRITE_DATE(new_node) = CT_LE_W(date);
24 
25Index: cpukit/libfs/src/dosfs/msdos_misc.c
26===================================================================
27RCS file: /usr1/CVS/rtems/cpukit/libfs/src/dosfs/msdos_misc.c,v
28retrieving revision 1.14
29diff -c -3 -p -r1.14 msdos_misc.c
30*** cpukit/libfs/src/dosfs/msdos_misc.c 4 Sep 2008 08:33:06 -0000       1.14
31--- cpukit/libfs/src/dosfs/msdos_misc.c 4 Feb 2009 11:01:40 -0000
32*************** msdos_find_name(
33*** 176,182 ****
34          time_val = *MSDOS_DIR_WRITE_TIME(node_entry);
35          date = *MSDOS_DIR_WRITE_DATE(node_entry);
36 
37!         fat_fd->mtime = msdos_date_dos2unix(CF_LE_W(time_val), CF_LE_W(date));
38 
39          if ((*MSDOS_DIR_ATTR(node_entry)) & MSDOS_ATTR_DIRECTORY)
40          {
41--- 176,182 ----
42          time_val = *MSDOS_DIR_WRITE_TIME(node_entry);
43          date = *MSDOS_DIR_WRITE_DATE(node_entry);
44 
45!         fat_fd->mtime = msdos_date_dos2unix(CF_LE_W(date), CF_LE_W(time_val));
46 
47          if ((*MSDOS_DIR_ATTR(node_entry)) & MSDOS_ATTR_DIRECTORY)
48          {
49*************** msdos_set_dir_wrt_time_and_date(
50*** 518,524 ****
51      uint32_t         sec = 0;
52      uint32_t         byte = 0;
53 
54!     msdos_date_unix2dos(fat_fd->mtime, &time_val, &date);
55 
56      /*
57       * calculate input for _fat_block_write: convert (cluster num, offset) to
58--- 518,524 ----
59      uint32_t         sec = 0;
60      uint32_t         byte = 0;
61 
62!     msdos_date_unix2dos(fat_fd->mtime, &date, &time_val);
63 
64      /*
65       * calculate input for _fat_block_write: convert (cluster num, offset) to