Aaro Saila 1 giorno fa
parent
commit
bb666abd22
2 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 1 1
      ch3/TCPServerUtility.c
  2. 2 2
      common/Practical.c

+ 1 - 1
ch3/TCPServerUtility.c

@@ -22,7 +22,7 @@ int setup_tcp_server_socket(const char *service) {
 
     int serv_sock = -1;
     for (struct addrinfo *addr = serv_addr; addr != nullptr; addr = addr->ai_next) {
-        serv_sock = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
+        serv_sock = socket(AF_to_PF(addr->ai_family), addr->ai_socktype, addr->ai_protocol);
         if (serv_sock < 0) {
             continue;
         }

+ 2 - 2
common/Practical.c

@@ -54,7 +54,7 @@ void PrintSocketAddress(const struct sockaddr *address, FILE *stream) {
     }
 }
 
-// Mentioned as a possible exercise in 3.2.1
+// Chapter 3 exercise 4
 int AF_to_PF(const int af) {
     switch (af) {
     case AF_UNSPEC:
@@ -151,7 +151,7 @@ int AF_to_PF(const int af) {
         return PF_MAX;
     }
 
-    // Handle entries that (currently) have the same value
+    // Handle entries that (currently) have duplicate values
     if (af == AF_UNIX) {
         return PF_UNIX;
     }