diff options
-rw-r--r-- | alarm-tools/alarms-show.c | 4 | ||||
-rw-r--r-- | alarmd/alarmd.c | 3 | ||||
-rw-r--r-- | lib/libalarm.c | 8 |
3 files changed, 4 insertions, 11 deletions
diff --git a/alarm-tools/alarms-show.c b/alarm-tools/alarms-show.c index 8418ee8..938401e 100644 --- a/alarm-tools/alarms-show.c +++ b/alarm-tools/alarms-show.c @@ -21,7 +21,7 @@ int dump_alarms(int sock) char buffer[128]; pid_t owner = 0; - packet_type = htonl(ALARMD_PACKET_TYPE_QUERY); + packet_type = ALARMD_PACKET_TYPE_QUERY; if (send(sock, &packet_type, sizeof(packet_type), 0) != sizeof(packet_type)) { perror("send"); @@ -37,8 +37,6 @@ int dump_alarms(int sock) return 1; } - count = ntohl(count); - printf("Alarms\n" "------\n"); diff --git a/alarmd/alarmd.c b/alarmd/alarmd.c index 3f95142..d1cef7d 100644 --- a/alarmd/alarmd.c +++ b/alarmd/alarmd.c @@ -140,7 +140,7 @@ int handle_query(int c_sock) struct alarm *tmp = NULL; /* LOCK */ - count = htonl(HASH_COUNT(alarms)); + count = HASH_COUNT(alarms); if (send(c_sock, &count, sizeof(count), 0) < sizeof(count)) { perror("send"); @@ -229,7 +229,6 @@ int main(int argc, char **argv) fprintf(stderr, "Packet type too short\n"); return 1; } - packet_type = ntohl(packet_type); switch(packet_type) { case ALARMD_PACKET_TYPE_REGISTER: diff --git a/lib/libalarm.c b/lib/libalarm.c index 6140580..9dc9ae0 100644 --- a/lib/libalarm.c +++ b/lib/libalarm.c @@ -57,11 +57,7 @@ int send_string(int sock, char *buffer) /* Helper function */ int send_packet_uuid(int sock, uint32_t packet_type, uuid_t uuid) { - uint32_t packet_type_n = 0; - - packet_type_n = htonl(packet_type); - - return (send(sock, &packet_type_n, sizeof(packet_type_n), 0) != sizeof(packet_type_n) + return (send(sock, &packet_type, sizeof(packet_type), 0) != sizeof(packet_type) || send(sock, uuid, 16, 0) != 16); } @@ -73,7 +69,7 @@ int alarmd_register(int sock, char *desc, uuid_t *uuid) uint8_t length = 0; uint32_t packet_type = 0; - packet_type = htonl(ALARMD_PACKET_TYPE_REGISTER); + packet_type = ALARMD_PACKET_TYPE_REGISTER; if (send(sock, &packet_type, sizeof(packet_type), 0) != sizeof(packet_type)) { perror("send"); return 1; |