summaryrefslogtreecommitdiffstats
path: root/misc-utils/uuidd.c
diff options
context:
space:
mode:
authorPetr Uzel2011-02-01 16:08:27 +0100
committerKarel Zak2011-02-08 15:01:30 +0100
commit783140784a2adc515798bd1555b39e49b4f70e40 (patch)
treed53706749cfb3dc784a292572c0b45757adabecd /misc-utils/uuidd.c
parentuuidd: fix uuidd -r -n 2 (diff)
downloadkernel-qcow2-util-linux-783140784a2adc515798bd1555b39e49b4f70e40.tar.gz
kernel-qcow2-util-linux-783140784a2adc515798bd1555b39e49b4f70e40.tar.xz
kernel-qcow2-util-linux-783140784a2adc515798bd1555b39e49b4f70e40.zip
uuidd: use UUIDD_OP_BULK_*_UUID named constants
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Diffstat (limited to 'misc-utils/uuidd.c')
-rw-r--r--misc-utils/uuidd.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c
index 2c8d2ca06..4a230fb28 100644
--- a/misc-utils/uuidd.c
+++ b/misc-utils/uuidd.c
@@ -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)