From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Schwab Subject: Re: [RFC 3/8] snd-aoa: add soundbus Date: Fri, 02 Jun 2006 16:41:14 +0200 Message-ID: References: <20060601115844.343214000@sipsolutions.net> <20060601115846.852128000@sipsolutions.net> <1149257225.11092.22.camel@johannes.berg> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mx1.suse.de (mx1.suse.de [195.135.220.2]) by alsa.jcu.cz (ALSA's E-mail Delivery System) with ESMTP id 679BF156 for ; Fri, 2 Jun 2006 16:41:15 +0200 (MEST) In-Reply-To: (Takashi Iwai's message of "Fri, 02 Jun 2006 16:21:35 +0200") List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@lists.sourceforge.net Errors-To: alsa-devel-bounces@lists.sourceforge.net To: Takashi Iwai Cc: linuxppc-dev@ozlabs.org, Johannes Berg , alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org Takashi Iwai writes: > At Fri, 02 Jun 2006 16:07:05 +0200, > Johannes Berg wrote: >> = >> On Fri, 2006-06-02 at 15:53 +0200, Takashi Iwai wrote: >> > > + if (strlen(sdev->modalias)) { >> > > + length =3D snprintf (buf, 34, "%s\n", sdev->modalias); >> > = >> > sizeof(sdev->modalias) + 2? But still strange if modalias has no >> > nul-end. >> = >> Hm, how would I handle that if modalias has no nul? > > Well, I'm not sure whether modalias is always nul-terminated. If modalias is not nul-terminated then strlen will already fail. > Otherwise (if not nul-terminated), I'd implement like: > > strlcpy(buf, sdev->modalias, sizeof(sdev->modalias) + 1); > strcpy(buf, "\n"); strcat? Andreas. -- = Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany PGP key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.suse.de (cantor.suse.de [195.135.220.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx1.suse.de", Issuer "Thawte Premium Server CA" (verified OK)) by ozlabs.org (Postfix) with ESMTP id 9E92D67B2E for ; Sat, 3 Jun 2006 00:41:19 +1000 (EST) From: Andreas Schwab To: Takashi Iwai Subject: Re: [Alsa-devel] [RFC 3/8] snd-aoa: add soundbus References: <20060601115844.343214000@sipsolutions.net> <20060601115846.852128000@sipsolutions.net> <1149257225.11092.22.camel@johannes.berg> Date: Fri, 02 Jun 2006 16:41:14 +0200 In-Reply-To: (Takashi Iwai's message of "Fri, 02 Jun 2006 16:21:35 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Cc: linuxppc-dev@ozlabs.org, Johannes Berg , alsa-devel@alsa-project.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Takashi Iwai writes: > At Fri, 02 Jun 2006 16:07:05 +0200, > Johannes Berg wrote: >> >> On Fri, 2006-06-02 at 15:53 +0200, Takashi Iwai wrote: >> > > + if (strlen(sdev->modalias)) { >> > > + length = snprintf (buf, 34, "%s\n", sdev->modalias); >> > >> > sizeof(sdev->modalias) + 2? But still strange if modalias has no >> > nul-end. >> >> Hm, how would I handle that if modalias has no nul? > > Well, I'm not sure whether modalias is always nul-terminated. If modalias is not nul-terminated then strlen will already fail. > Otherwise (if not nul-terminated), I'd implement like: > > strlcpy(buf, sdev->modalias, sizeof(sdev->modalias) + 1); > strcpy(buf, "\n"); strcat? Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."