From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5374 Path: news.gmane.org!not-for-mail From: Isaac Dunham Newsgroups: gmane.linux.lib.musl.general,gmane.linux.distributions.alpine.devel Subject: Re: cups debugging, continued...ugly patch Date: Sun, 29 Jun 2014 22:34:27 -0700 Message-ID: <20140630053426.GC16088@newbook> References: <20140629194829.GA1994@newbook> <20140630001201.GA14838@newbook> <20140630012830.GA16088@newbook> <20140630020311.GD179@brightrain.aerifal.cx> <20140630043512.GB16088@newbook> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="4Ckj6UjgE2iN1+kY" X-Trace: ger.gmane.org 1404106463 15825 80.91.229.3 (30 Jun 2014 05:34:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 30 Jun 2014 05:34:23 +0000 (UTC) Cc: alpine-devel@lists.alpinelinux.org To: musl@lists.openwall.com Original-X-From: musl-return-5379-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jun 30 07:34:18 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1X1UEL-0002rA-Us for gllmg-musl@plane.gmane.org; Mon, 30 Jun 2014 07:34:18 +0200 Original-Received: (qmail 19883 invoked by uid 550); 30 Jun 2014 05:34:17 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 19875 invoked from network); 30 Jun 2014 05:34:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=4XnqpaiHn7kkS2ERUQZF2D0BoVTB6Kfc+fOLynBJ3uE=; b=KRbS68tLcUwNOXCDhRr3YfinWbDkBUZhPfgt7rG+0K777usrRsYELKNr2OMIBudaWQ /SmwayuPjaooCpRnildS1YLy3I5fnIRG2SYL3kH9vqYe0CvIjaCby9HPCaynD90YQt10 fwXZnWdvr+DvF+hhuSc38Ybw32Ieq27HHGVdyoMK4i9mqyWR7UcTFfOZk9RpM8gXIH1v ts2fbB0PPR799wh8rsH6zPF/xm4AO+aNdPSD4hOapKvnYZwISivcPul+IrRNgw0+ZBFO eLck0BRkKuTjHiK8D4SRU1vqbWwDjKlHqoACSkc7TPCViPF7t/HQ0RTxANtQFWxnzlIt r4jw== X-Received: by 10.66.169.136 with SMTP id ae8mr49318236pac.14.1404106444235; Sun, 29 Jun 2014 22:34:04 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20140630043512.GB16088@newbook> User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:5374 gmane.linux.distributions.alpine.devel:2014 Archived-At: --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Thanks to Rich's comment, I've found a solution that works here. The patch doesn't exactly look nice, though. And yes, once I add this patch I can print using Peter De Wachter's brlaser driver (github.com/pdewacht/brlaser). I'll be sending a patch for main/cups to alpine-devel shortly, and probably packaging brlaser for alpine. HTH, Isaac Dunham --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="socksz.diff" diff --git a/backend/lpd.c b/backend/lpd.c index 6e4ab36..bbffb82 100644 --- a/backend/lpd.c +++ b/backend/lpd.c @@ -1244,6 +1244,7 @@ rresvport_af(int *port, /* IO - Port number to bind to */ { http_addr_t addr; /* Socket address */ int fd; /* Socket file descriptor */ + socklen_t socksz=sizeof(struct sockaddr); /* size of struct sockaddr* */ /* @@ -1260,6 +1261,23 @@ rresvport_af(int *port, /* IO - Port number to bind to */ memset(&addr, 0, sizeof(addr)); addr.addr.sa_family = family; + switch(family) { + case AF_INET: + socksz = sizeof(struct sockaddr_in); + break; +#ifdef AF_INET6 + case AF_INET6: + socksz = sizeof(struct sockaddr_in6); + break; +#endif +#ifdef AF_LOCAL + case AF_LOCAL: + socksz = sizeof(struct sockaddr_un); +#endif + default: + break; + } + /* * Try to bind the socket to a reserved port... */ @@ -1276,7 +1294,7 @@ rresvport_af(int *port, /* IO - Port number to bind to */ * Try binding the port to the socket; return if all is OK... */ - if (!bind(fd, (struct sockaddr *)&addr, sizeof(addr))) + if (!bind(fd, (struct sockaddr *)&addr, socksz)) return (fd); /* --4Ckj6UjgE2iN1+kY--