Convert sizeof foo to sizeof(foo).
[tinc] / src / raw_socket_device.c
index a8c2c86..18fbdde 100644 (file)
@@ -53,7 +53,7 @@ static bool setup_device(void) {
                return false;
        }
 
-       memset(&ifr, 0, sizeof ifr);
+       memset(&ifr, 0, sizeof(ifr));
 
 #ifdef FD_CLOEXEC
        fcntl(device_fd, F_SETFD, FD_CLOEXEC);
@@ -67,12 +67,12 @@ static bool setup_device(void) {
                return false;
        }
 
-       memset(&sa, '0', sizeof sa);
+       memset(&sa, '0', sizeof(sa));
        sa.sll_family = AF_PACKET;
        sa.sll_protocol = htons(ETH_P_ALL);
        sa.sll_ifindex = ifr.ifr_ifindex;
 
-       if(bind(device_fd, (struct sockaddr *) &sa, (socklen_t) sizeof sa)) {
+       if(bind(device_fd, (struct sockaddr *) &sa, (socklen_t) sizeof(sa))) {
                logger(DEBUG_ALWAYS, LOG_ERR, "Could not bind %s to %s: %s", device, iface, strerror(errno));
                return false;
        }
@@ -93,7 +93,7 @@ static void close_device(void) {
 static bool read_packet(vpn_packet_t *packet) {
        int inlen;
 
-       if((inlen = read(device_fd, packet->data, MTU)) <= 0) {
+       if((inlen = read(device_fd, DATA(packet), MTU)) <= 0) {
                logger(DEBUG_ALWAYS, LOG_ERR, "Error while reading from %s %s: %s", device_info,
                           device, strerror(errno));
                return false;
@@ -111,7 +111,7 @@ static bool write_packet(vpn_packet_t *packet) {
        logger(DEBUG_TRAFFIC, LOG_DEBUG, "Writing packet of %d bytes to %s",
                           packet->len, device_info);
 
-       if(write(device_fd, packet->data, packet->len) < 0) {
+       if(write(device_fd, DATA(packet), packet->len) < 0) {
                logger(DEBUG_ALWAYS, LOG_ERR, "Can't write to %s %s: %s", device_info, device,
                           strerror(errno));
                return false;