Ignore:
Timestamp:
2015-11-02T20:54:19Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d8513177
Parents:
3feeab2 (diff), 5265eea4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/mkfile/mkfile.c

    r3feeab2 rff381a7  
    2727 */
    2828
     29#include <errno.h>
    2930#include <stdio.h>
    3031#include <stdlib.h>
     
    166167
    167168                if ((rc2 = lseek(fd, file_size - 1, SEEK_SET)) < 0)
    168                         goto exit;
     169                        goto error;
    169170
    170171                rc2 = write(fd, &byte, sizeof(char));
    171                 goto exit;
     172                if (rc2 < 0)
     173                        goto error;
     174                return CMD_SUCCESS;
    172175        }
    173176
     
    183186                rc = write(fd, buffer, to_write);
    184187                if (rc <= 0) {
    185                         printf("%s: Error writing file (%zd).\n", cmdname, rc);
     188                        printf("%s: Error writing file (%d).\n", cmdname, errno);
    186189                        close(fd);
    187190                        return CMD_FAILURE;
     
    191194
    192195        free(buffer);
    193 exit:
    194         rc = close(fd);
    195 
    196         if (rc != 0 || rc2 < 0) {
    197                 printf("%s: Error writing file (%zd).\n", cmdname, rc);
    198                 return CMD_FAILURE;
    199         }
     196
     197        if (close(fd) < 0)
     198                goto error;
    200199
    201200        return CMD_SUCCESS;
     201error:
     202        printf("%s: Error writing file (%d).\n", cmdname, errno);
     203        return CMD_FAILURE;
    202204}
Note: See TracChangeset for help on using the changeset viewer.