From: Michael R Sweet Date: Tue, 1 Jun 2021 15:43:25 +0000 (-0400) Subject: Fix some Windows issues: X-Git-Tag: v2.4b1~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5687bd03d3856de83ccdc01305f5ecd8804027e;p=thirdparty%2Fcups.git Fix some Windows issues: - cupsDirRead wasn't working - missing wildcard for FindFirst/FindNext. - httpAddrListen/httpAddrConnect2 were missing the socket initialization code. --- diff --git a/CHANGES.md b/CHANGES.md index 5d99e6a3ca..3b22c19910 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -52,6 +52,7 @@ CUPS v2.4rc1 (Pending) - USB quirk updates (Apple #5766, Apple #5838, Apple #5843, Apple #5867) - Web interface updates (Issue #142) - The `ippeveprinter` tool now automatically uses an available port. +- Fixed some Windows issues. - Deprecated cups-config (Issue #97) - Deprecated Kerberos (`AuthType Negotiate`) authentication (Issue #98) - Removed support for the (long deprecated and unused) `FontPath`, diff --git a/cups/dir.c b/cups/dir.c index 184aa7c196..f6ac911bac 100644 --- a/cups/dir.c +++ b/cups/dir.c @@ -3,10 +3,11 @@ * * This set of APIs abstracts enumeration of directory entries. * - * Copyright 2007-2017 by Apple Inc. - * Copyright 1997-2005 by Easy Software Products, all rights reserved. + * Copyright © 2007-2021 by Apple Inc. + * Copyright © 1997-2005 by Easy Software Products, all rights reserved. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ /* @@ -122,7 +123,7 @@ cupsDirOpen(const char *directory) /* I - Directory name */ dp->dir = INVALID_HANDLE_VALUE; - strlcpy(dp->directory, directory, sizeof(dp->directory)); + snprintf(dp->directory, sizeof(dp->directory), "%s\\*", directory); /* * Return the new directory structure... @@ -168,6 +169,16 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory pointer */ else if (!FindNextFileA(dp->dir, &entry)) return (NULL); + /* + * Loop until we have something other than "." or ".."... + */ + + while (!strcmp(entry.cFileName, ".") || !strcmp(entry.cFileName, "..")) + { + if (!FindNextFileA(dp->dir, &entry)) + return (NULL); + } + /* * Copy the name over and convert the file information... */ diff --git a/cups/http-addr.c b/cups/http-addr.c index 8e81c6f7db..114a6449a2 100644 --- a/cups/http-addr.c +++ b/cups/http-addr.c @@ -1,8 +1,8 @@ /* * HTTP address routines for CUPS. * - * Copyright 2007-2019 by Apple Inc. - * Copyright 1997-2006 by Easy Software Products, all rights reserved. + * Copyright © 2007-2021 by Apple Inc. + * Copyright © 1997-2006 by Easy Software Products, all rights reserved. * * Licensed under Apache License v2.0. See the file "LICENSE" for more * information. @@ -169,6 +169,12 @@ httpAddrListen(http_addr_t *addr, /* I - Address to bind to */ if (!addr || port < 0) return (-1); + /* + * Make sure the network stack is initialized... + */ + + httpInitialize(); + /* * Create the socket and set options... */ diff --git a/cups/http-addrlist.c b/cups/http-addrlist.c index 975016b60e..56380cb925 100644 --- a/cups/http-addrlist.c +++ b/cups/http-addrlist.c @@ -1,8 +1,8 @@ /* * HTTP address list routines for CUPS. * - * Copyright 2007-2018 by Apple Inc. - * Copyright 1997-2007 by Easy Software Products, all rights reserved. + * Copyright © 2007-2021 by Apple Inc. + * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * * Licensed under Apache License v2.0. See the file "LICENSE" for more * information. @@ -100,6 +100,8 @@ httpAddrConnect2( if (cancel && *cancel) return (NULL); + httpInitialize(); + if (msec <= 0) msec = INT_MAX;