]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
uuidd: use UUIDD_OP_BULK_*_UUID named constants
authorPetr Uzel <petr.uzel@suse.cz>
Tue, 1 Feb 2011 15:08:27 +0000 (16:08 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 8 Feb 2011 14:01:30 +0000 (15:01 +0100)
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
misc-utils/uuidd.c

index 2c8d2ca06697b71896377711c053ddea1259e033..4a230fb28121bf9dcaf7231fa99f043fdf3cda35 100644 (file)
@@ -147,7 +147,8 @@ static int call_daemon(const char *socket_path, int op, char *buf,
        int32_t reply_len = 0;
        struct sockaddr_un srv_addr;
 
-       if (((op == 4) || (op == 5)) && !num) {
+       if (((op == UUIDD_OP_BULK_TIME_UUID) ||
+            (op == UUIDD_OP_BULK_RANDOM_UUID)) && !num) {
                if (err_context)
                        *err_context = _("bad arguments");
                errno = EINVAL;
@@ -172,13 +173,14 @@ static int call_daemon(const char *socket_path, int op, char *buf,
                return -1;
        }
 
-       if (op == 5) {
+       if (op == UUIDD_OP_BULK_RANDOM_UUID) {
                if ((*num)*16 > buflen-4)
                        *num = (buflen-4) / 16;
        }
        op_buf[0] = op;
        op_len = 1;
-       if ((op == 4) || (op == 5)) {
+       if ((op == UUIDD_OP_BULK_TIME_UUID) ||
+           (op == UUIDD_OP_BULK_RANDOM_UUID)) {
                memcpy(op_buf+1, num, sizeof(int));
                op_len += sizeof(int);
        }
@@ -206,13 +208,13 @@ static int call_daemon(const char *socket_path, int op, char *buf,
        }
        ret = read_all(s, (char *) buf, reply_len);
 
-       if ((ret > 0) && (op == 4)) {
+       if ((ret > 0) && (op == UUIDD_OP_BULK_TIME_UUID)) {
                if (reply_len >= (int) (16+sizeof(int)))
                        memcpy(buf+16, num, sizeof(int));
                else
                        *num = -1;
        }
-       if ((ret > 0) && (op == 5)) {
+       if ((ret > 0) && (op == UUIDD_OP_BULK_RANDOM_UUID)) {
                if (reply_len >= (int) sizeof(int))
                        memcpy(buf, num, sizeof(int));
                else
@@ -352,7 +354,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
                                         "len = %d\n"), len);
                        goto shutdown_socket;
                }
-               if ((op == 4) || (op == 5)) {
+               if ((op == UUIDD_OP_BULK_TIME_UUID) ||
+                   (op == UUIDD_OP_BULK_RANDOM_UUID)) {
                        if (read_all(ns, (char *) &num, sizeof(num)) != 4)
                                goto shutdown_socket;
                        if (debug)