Changeset 84a1a54 in mainline for uspace/srv/hid/rfb/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/srv/hid/rfb/main.c

    rcde999a r84a1a54  
    220220        if (rc != EOK) {
    221221                printf("%s: Unable to register server.\n", NAME);
    222                 return rc;
     222                return EXIT_RC(rc);
    223223        }
    224224
    225225        char *service_name;
    226         rc = asprintf(&service_name, "rfb/%s", rfb_name);
    227         if (rc < 0) {
     226        if (asprintf(&service_name, "rfb/%s", rfb_name) < 0) {
    228227                printf(NAME ": Unable to create service name\n");
    229                 return rc;
     228                return EXIT_RC(ENOMEM);
    230229        }
    231230
     
    235234        if (rc != EOK) {
    236235                printf(NAME ": Unable to register service %s.\n", service_name);
    237                 return rc;
     236                return EXIT_RC(rc);
    238237        }
    239238       
Note: See TracChangeset for help on using the changeset viewer.