On Sat, Sep 06, 2014 at 12:24:51PM +0100, Sami Kerola wrote: > +static int getprio(const int which, const int who, const char *idtype) > +{ > + int ret; > + > + errno = 0; > + ret = getpriority(which, who); > + if (ret == -1 && errno) { > + warn(_("failed to get priority for %d (%s)"), who, idtype); > + return PRIO_MAX + 1; > + } > + return ret; > +} This is exactly the situation when you want to use "return" only for function status rather than for any data. static int getprio(const int which, const int who, const char *idtype, int *prio) <--------! { errno = 0; *prio = getpriority(which, who); if (*prio == -1 && errno) { warn(_("failed to get priority for %d (%s)"), who, idtype); return -errno; } return 0; } > - errno = 0; > - newprio = getpriority(which, who); > - if (newprio == -1 && errno) { > - warn(_("failed to get priority for %d (%s)"), who, idtype); > + if ((newprio = getprio(which, who, idtype)) == PRIO_MAX + 1) > return 1; > - } if (getprio(which, who, idtype, &newprio) != 0) return 1; .. so you don't need complicated things like PRIO_MAX + 1. Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html