[PATCH] untar: check return value from mkdir

Gedare Bloom gedare at rtems.org
Thu Sep 5 18:11:33 UTC 2013


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;
+         }
       }
    }
 
-- 
1.7.1




More information about the devel mailing list