Changeset 84a1a54 in mainline for uspace/app/mkbd/main.c


Ignore:
Timestamp:
2018-01-04T20:47:53Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
facacc71
Parents:
cde999a
Message:

Wrap returns of errno from main() with EXIT_RC().

Returns of error code from main() prevent type checking when errno_t
and int are considered incompatible. In order to avoid the philosophical
discussion of what should and shouldn't be returned for main(), we simply
wrap the error values and leave the answer to the question for future
generations to decide.

File:
1 edited

Legend:

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

    rcde999a r84a1a54  
    222222                printf("Device not found or not of USB kind: %s.\n",
    223223                    str_error(rc));
    224                 return rc;
     224                return EXIT_RC(rc);
    225225        }
    226226       
     
    229229                printf(NAME ": failed to connect to the device (handle %"
    230230                       PRIun "): %s.\n", dev_handle, str_error(errno));
    231                 return errno;
     231                return EXIT_RC(errno);
    232232        }
    233233       
     
    239239                printf(NAME ": failed to get path (handle %"
    240240                       PRIun "): %s.\n", dev_handle, str_error(errno));
    241                 return ENOMEM;
     241                return EXIT_RC(ENOMEM);
    242242        }
    243243       
     
    250250                printf("Failed to initialize report parser: %s\n",
    251251                    str_error(rc));
    252                 return rc;
     252                return EXIT_RC(rc);
    253253        }
    254254       
     
    259259        if (rc != EOK) {
    260260                printf("Failed to get event length: %s.\n", str_error(rc));
    261                 return rc;
     261                return EXIT_RC(rc);
    262262        }
    263263       
     
    266266                printf("Out of memory.\n");
    267267                // TODO: hangup phone?
    268                 return ENOMEM;
     268                return EXIT_RC(ENOMEM);
    269269        }
    270270       
Note: See TracChangeset for help on using the changeset viewer.