diff options
author | Sami Kerola | 2011-06-25 14:58:35 +0200 |
---|---|---|
committer | Sami Kerola | 2011-06-25 14:58:35 +0200 |
commit | 2fb35353fd78e93ab9c44c5acfc4beef3d7011e0 (patch) | |
tree | ae0f583adee1c080c5883275a52a9f9734772e84 /misc-utils/uuidd.c | |
parent | uuidd: use symbolic exit and return values (diff) | |
download | kernel-qcow2-util-linux-2fb35353fd78e93ab9c44c5acfc4beef3d7011e0.tar.gz kernel-qcow2-util-linux-2fb35353fd78e93ab9c44c5acfc4beef3d7011e0.tar.xz kernel-qcow2-util-linux-2fb35353fd78e93ab9c44c5acfc4beef3d7011e0.zip |
uuidd: remove goto statement
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'misc-utils/uuidd.c')
-rw-r--r-- | misc-utils/uuidd.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c index db91a136c..75fc2a570 100644 --- a/misc-utils/uuidd.c +++ b/misc-utils/uuidd.c @@ -414,6 +414,11 @@ static void server_loop(const char *socket_path, const char *pidfile_path, } } +static void __attribute__ ((__noreturn__)) unexpected_size(int size) +{ + errx(EXIT_FAILURE, _("Unexpected reply length from server %d"), size); +} + int main(int argc, char **argv) { const char *socket_path = UUIDD_SOCKET_PATH; @@ -531,7 +536,7 @@ int main(int argc, char **argv) } if (do_type == UUIDD_OP_TIME_UUID) { if (ret != sizeof(uu) + sizeof(num)) - goto unexpected_size; + unexpected_size(ret); uuid_unparse((unsigned char *) buf, str); @@ -540,7 +545,7 @@ int main(int argc, char **argv) printf(_("List of UUIDs:\n")); cp = buf + 4; if (ret != (int) (sizeof(num) + num*sizeof(uu))) - goto unexpected_size; + unexpected_size(ret); for (i=0; i < num; i++, cp+=UUID_LEN) { uuid_unparse((unsigned char *) cp, str); printf("\t%s\n", str); @@ -556,12 +561,9 @@ int main(int argc, char **argv) err_context, strerror(errno)); return EXIT_FAILURE; } - if (ret != sizeof(uu)) { - unexpected_size: - printf(_("Unexpected reply length from server %d\n"), - ret); - return EXIT_FAILURE; - } + if (ret != sizeof(uu)) + unexpected_size(ret); + uuid_unparse(uu, str); printf("%s\n", str); |