Changeset 6afc9d7 in mainline for uspace/app/untar/main.c


Ignore:
Timestamp:
2015-10-06T19:01:36Z (9 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0328987
Parents:
f1f7584
Message:

UNIX-like I/O functions should use errno to return error code for many reasons.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/untar/main.c

    rf1f7584 r6afc9d7  
    103103static int handle_directory(const tar_header_t *header, FILE *tarfile)
    104104{
    105         int rc = mkdir(header->filename, 0755);
    106         if (rc == EEXIST) {
    107                 // printf("Note: directory %s already exists.\n", header->filename);
    108                 rc = EOK;
    109         }
    110         if (rc != EOK) {
    111                 fprintf(stderr, "Failed to create directory %s: %s.\n",
    112                     header->filename, str_error(rc));
    113                 return rc;
     105        if (mkdir(header->filename, 0755) != 0) {
     106                if (errno != EEXIST) {
     107                        fprintf(stderr, "Failed to create directory %s: %s.\n",
     108                            header->filename, str_error(errno));
     109                        return errno;
     110                }
    114111        }
    115112
Note: See TracChangeset for help on using the changeset viewer.