From ce768385713db023e874db420b034dcbe94b5d48 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Wed, 27 Jun 2018 22:29:13 +1200 Subject: Remove old byte-order switching code It's safe enough to assume that UNIX domain sockets imply both ends of the socket have the same represenatations. Anyone doing hackery with forwarding/proxying UNIX domain sockets between systems should know better. --- lib/libalarm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'lib') 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; -- cgit v1.1