Fossil SCM
Fix indentation and remove all strcpy() and strcat() calls (as OpenBSD hates those).
Commit
b1cb81ebe7c114f3c41e23f39a3854fe84f7576f
Parent
dae37f0e3583680…
1 file changed
+12
-13
+12
-13
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -1718,32 +1718,31 @@ | ||
| 1718 | 1718 | fd_set readfds; /* Set of file descriptors for select() */ |
| 1719 | 1719 | socklen_t lenaddr; /* Length of the inaddr structure */ |
| 1720 | 1720 | int child; /* PID of the child process */ |
| 1721 | 1721 | int nchildren = 0; /* Number of child processes */ |
| 1722 | 1722 | struct timeval delay; /* How long to wait inside select() */ |
| 1723 | - struct sockaddr_in6 inaddr; /* The socket address */ | |
| 1724 | - int optyes = 1; /* setsockopt flag */ | |
| 1725 | - int optno = 0; /* setsockopt flag */ | |
| 1723 | + struct sockaddr_in6 inaddr; /* The socket address */ | |
| 1724 | + int optyes = 1; /* setsockopt flag */ | |
| 1725 | + int optno = 0; /* setsockopt flag */ | |
| 1726 | 1726 | int iPort = mnPort; |
| 1727 | 1727 | char ip[INET6_ADDRSTRLEN]; |
| 1728 | 1728 | |
| 1729 | 1729 | |
| 1730 | 1730 | while( iPort<=mxPort ){ |
| 1731 | 1731 | memset(&inaddr, 0, sizeof(inaddr)); |
| 1732 | 1732 | inaddr.sin6_family = AF_INET6; |
| 1733 | 1733 | if( zIpAddr ){ |
| 1734 | - printf("zIpAddr: %s", zIpAddr); | |
| 1735 | - printf("iPort: %d", iPort); | |
| 1736 | - /* check valid ipv6 address */ | |
| 1734 | + printf("zIpAddr: %s", zIpAddr); | |
| 1735 | + printf("iPort: %d", iPort); | |
| 1736 | + /* check valid ipv6 address */ | |
| 1737 | 1737 | if (inet_pton(AF_INET6, zIpAddr, &(inaddr.sin6_addr)) < 1) { |
| 1738 | - /* maybe ipv4 string so try mixed ipv4 notation*/ | |
| 1739 | - strcpy(ip, "::FFFF:"); | |
| 1740 | - strcat(ip, zIpAddr); | |
| 1741 | - printf("zIpAddr: %s", ip); | |
| 1742 | - if (inet_pton(AF_INET6, ip, &(inaddr.sin6_addr)) == -1){ | |
| 1743 | - fossil_fatal("not a valid IP address: %s", zIpAddr); | |
| 1744 | - } | |
| 1738 | + /* maybe ipv4 string so try mixed ipv4 notation*/ | |
| 1739 | + sqlite3_snprintf(sizeof(ip), ip, "::FFFF:%s", zIpAddr); | |
| 1740 | + printf("zIpAddr: %s", ip); | |
| 1741 | + if (inet_pton(AF_INET6, ip, &(inaddr.sin6_addr)) == -1){ | |
| 1742 | + fossil_fatal("not a valid IP address: %s", zIpAddr); | |
| 1743 | + } | |
| 1745 | 1744 | } |
| 1746 | 1745 | }else if( flags & HTTP_SERVER_LOCALHOST ){ |
| 1747 | 1746 | inaddr.sin6_addr = in6addr_loopback; |
| 1748 | 1747 | }else{ |
| 1749 | 1748 | inaddr.sin6_addr = in6addr_any; |
| 1750 | 1749 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -1718,32 +1718,31 @@ | |
| 1718 | fd_set readfds; /* Set of file descriptors for select() */ |
| 1719 | socklen_t lenaddr; /* Length of the inaddr structure */ |
| 1720 | int child; /* PID of the child process */ |
| 1721 | int nchildren = 0; /* Number of child processes */ |
| 1722 | struct timeval delay; /* How long to wait inside select() */ |
| 1723 | struct sockaddr_in6 inaddr; /* The socket address */ |
| 1724 | int optyes = 1; /* setsockopt flag */ |
| 1725 | int optno = 0; /* setsockopt flag */ |
| 1726 | int iPort = mnPort; |
| 1727 | char ip[INET6_ADDRSTRLEN]; |
| 1728 | |
| 1729 | |
| 1730 | while( iPort<=mxPort ){ |
| 1731 | memset(&inaddr, 0, sizeof(inaddr)); |
| 1732 | inaddr.sin6_family = AF_INET6; |
| 1733 | if( zIpAddr ){ |
| 1734 | printf("zIpAddr: %s", zIpAddr); |
| 1735 | printf("iPort: %d", iPort); |
| 1736 | /* check valid ipv6 address */ |
| 1737 | if (inet_pton(AF_INET6, zIpAddr, &(inaddr.sin6_addr)) < 1) { |
| 1738 | /* maybe ipv4 string so try mixed ipv4 notation*/ |
| 1739 | strcpy(ip, "::FFFF:"); |
| 1740 | strcat(ip, zIpAddr); |
| 1741 | printf("zIpAddr: %s", ip); |
| 1742 | if (inet_pton(AF_INET6, ip, &(inaddr.sin6_addr)) == -1){ |
| 1743 | fossil_fatal("not a valid IP address: %s", zIpAddr); |
| 1744 | } |
| 1745 | } |
| 1746 | }else if( flags & HTTP_SERVER_LOCALHOST ){ |
| 1747 | inaddr.sin6_addr = in6addr_loopback; |
| 1748 | }else{ |
| 1749 | inaddr.sin6_addr = in6addr_any; |
| 1750 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -1718,32 +1718,31 @@ | |
| 1718 | fd_set readfds; /* Set of file descriptors for select() */ |
| 1719 | socklen_t lenaddr; /* Length of the inaddr structure */ |
| 1720 | int child; /* PID of the child process */ |
| 1721 | int nchildren = 0; /* Number of child processes */ |
| 1722 | struct timeval delay; /* How long to wait inside select() */ |
| 1723 | struct sockaddr_in6 inaddr; /* The socket address */ |
| 1724 | int optyes = 1; /* setsockopt flag */ |
| 1725 | int optno = 0; /* setsockopt flag */ |
| 1726 | int iPort = mnPort; |
| 1727 | char ip[INET6_ADDRSTRLEN]; |
| 1728 | |
| 1729 | |
| 1730 | while( iPort<=mxPort ){ |
| 1731 | memset(&inaddr, 0, sizeof(inaddr)); |
| 1732 | inaddr.sin6_family = AF_INET6; |
| 1733 | if( zIpAddr ){ |
| 1734 | printf("zIpAddr: %s", zIpAddr); |
| 1735 | printf("iPort: %d", iPort); |
| 1736 | /* check valid ipv6 address */ |
| 1737 | if (inet_pton(AF_INET6, zIpAddr, &(inaddr.sin6_addr)) < 1) { |
| 1738 | /* maybe ipv4 string so try mixed ipv4 notation*/ |
| 1739 | sqlite3_snprintf(sizeof(ip), ip, "::FFFF:%s", zIpAddr); |
| 1740 | printf("zIpAddr: %s", ip); |
| 1741 | if (inet_pton(AF_INET6, ip, &(inaddr.sin6_addr)) == -1){ |
| 1742 | fossil_fatal("not a valid IP address: %s", zIpAddr); |
| 1743 | } |
| 1744 | } |
| 1745 | }else if( flags & HTTP_SERVER_LOCALHOST ){ |
| 1746 | inaddr.sin6_addr = in6addr_loopback; |
| 1747 | }else{ |
| 1748 | inaddr.sin6_addr = in6addr_any; |
| 1749 |