[rtems commit] dosfs: Simplify fat_file_open()

Sebastian Huber sebh at rtems.org
Thu Mar 16 14:35:06 UTC 2017


Module:    rtems
Branch:    master
Commit:    063eb574b98d02906443f99c9e95fc326a1aa6e2
Changeset: http://git.rtems.org/rtems/commit/?id=063eb574b98d02906443f99c9e95fc326a1aa6e2

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Mar 14 08:26:40 2017 +0100

dosfs: Simplify fat_file_open()

Update #2929.

---

 cpukit/libfs/src/dosfs/fat_file.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/cpukit/libfs/src/dosfs/fat_file.c b/cpukit/libfs/src/dosfs/fat_file.c
index cbc0ab3..c65c758 100644
--- a/cpukit/libfs/src/dosfs/fat_file.c
+++ b/cpukit/libfs/src/dosfs/fat_file.c
@@ -110,12 +110,10 @@ fat_file_open(
     /* access "removed-but-still-open" hash table */
     rc = _hash_search(fs_info, fs_info->rhash, key, key, &lfat_fd);
 
-    lfat_fd = (*fat_fd) = (fat_file_fd_t*)malloc(sizeof(fat_file_fd_t));
+    lfat_fd = (*fat_fd) = (fat_file_fd_t*)calloc(1, sizeof(fat_file_fd_t));
     if ( lfat_fd == NULL )
         rtems_set_errno_and_return_minus_one( ENOMEM );
 
-    memset(lfat_fd, 0, sizeof(fat_file_fd_t));
-
     lfat_fd->links_num = 1;
     lfat_fd->flags &= ~FAT_FILE_REMOVED;
     lfat_fd->map.last_cln = FAT_UNDEFINED_VALUE;




More information about the vc mailing list