[rtems commit] untar: check return value from mkdir

Gedare Bloom gedare at rtems.org
Thu Sep 5 19:07:52 UTC 2013


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

Author:    Gedare Bloom <gedare at rtems.org>
Date:      Thu Sep  5 14:10:52 2013 -0400

untar: check return value from mkdir

Check the return value from mkdir instead of failing silently.

1063857 Unchecked return value from library

---

 cpukit/libmisc/untar/untar.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/cpukit/libmisc/untar/untar.c b/cpukit/libmisc/untar/untar.c
index 9ed00e9..5f1699d 100644
--- a/cpukit/libmisc/untar/untar.c
+++ b/cpukit/libmisc/untar/untar.c
@@ -223,7 +223,11 @@ Untar_FromMemory(
       }
       else if (linkflag == DIRTYPE)
       {
-         mkdir(fname, S_IRWXU | S_IRWXG | S_IRWXO);
+         if ( mkdir(fname, S_IRWXU | S_IRWXG | S_IRWXO) != 0 ) {
+           printk("Untar: failed to create directory %s\n", fname);
+           retval = UNTAR_FAIL;
+           break;
+         }
       }
    }
 




More information about the vc mailing list