forked from Imagelibrary/rtems
Fix untar mkdir when the directory exists.
This commit is contained in:
@@ -189,7 +189,7 @@ Make_Path(const rtems_printer *printer, const char* filename, bool end_is_dir)
|
|||||||
if (!path_end) {
|
if (!path_end) {
|
||||||
r = mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO);
|
r = mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
Print_Error(printer, "mkdir", path);
|
Print_Error(printer, "mkdir (unlink)", path);
|
||||||
free(copy);
|
free(copy);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -319,7 +319,9 @@ Untar_ProcessHeader(
|
|||||||
if (errno == EEXIST) {
|
if (errno == EEXIST) {
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
if (stat(fname, &stat_buf) == 0) {
|
if (stat(fname, &stat_buf) == 0) {
|
||||||
if (!S_ISDIR(stat_buf.st_mode)) {
|
if (S_ISDIR(stat_buf.st_mode)) {
|
||||||
|
r = 0;
|
||||||
|
} else {
|
||||||
r = unlink(fname);
|
r = unlink(fname);
|
||||||
if (r == 0) {
|
if (r == 0) {
|
||||||
r = mkdir(fname, *mode);
|
r = mkdir(fname, *mode);
|
||||||
|
|||||||
Reference in New Issue
Block a user