X-Original-To: alpine-devel@lists.alpinelinux.org Delivered-To: alpine-devel@mail.alpinelinux.org Received: from ncopa-desktop.alpinelinux.org (3.203.202.84.customer.cdi.no [84.202.203.3]) (using SSLv3 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: n@tanael.org) by mail.alpinelinux.org (Postfix) with ESMTPSA id 83120DC0175; Mon, 15 Sep 2014 09:10:57 +0000 (UTC) Date: Mon, 15 Sep 2014 11:10:55 +0200 From: Natanael Copa To: Isaac Dunham Cc: alpine-devel@lists.alpinelinux.org Subject: Re: [alpine-devel] [PATCH] unmaintained/lshw: fix build Message-ID: <20140915111055.0a15bb15@ncopa-desktop.alpinelinux.org> In-Reply-To: <1410584314-15896-1-git-send-email-ibid.ag@gmail.com> References: <1410584314-15896-1-git-send-email-ibid.ag@gmail.com> X-Mailer: Claws Mail 3.10.1 (GTK+ 2.24.23; x86_64-alpine-linux-musl) X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 12 Sep 2014 21:58:34 -0700 Isaac Dunham wrote: > s/__\(u*int\)/\1/g > add headers > replace sysconf(_SC_LONG_BITS) with 8*sizeof(long) > make basename() usage conform to POSIX ... > + bool scan_abi(hwNode & system) > + { > + // are we compiled as 32- or 64-bit process ? > +- system.setWidth(sysconf(_SC_LONG_BIT)); > ++ system.setWidth(8*sizeof(long)); theoretically: #ifdef _SC_LONG_BIT int longbit = sysconf(_SC_LONG_BIT); if (longbit < 0) #endif longbit = 8*sizeof(long); system.setWidth(longbit); But since it is a compile time value (as comment indicates) i think what you do is good. ... > +@@ -1127,10 +1129,16 @@ bool scan_pci(hwNode & n) > + { > + string drivername = readlink(string(devices[i]->d_name)+"/driver"); > + string modulename = readlink(string(devices[i]->d_name)+"/driver/module"); > +- > +- device->setConfig("driver", basename(drivername.c_str())); > ++ char driver_c[PATH_MAX]; > ++ char module_c[PATH_MAX]; > ++ bzero(driver_c,PATH_MAX); > ++ bzero(module_c,PATH_MAX); > ++ strncpy(driver_c, drivername.c_str(),PATH_MAX); > ++ strncpy(module_c, modulename.c_str(),PATH_MAX); > ++ > ++ device->setConfig("driver", basename(driver_c)); > + if(exists(modulename)) > +- device->setConfig("module", basename(modulename.c_str())); > ++ device->setConfig("module", basename(module_c)); > + > + if(exists(string(devices[i]->d_name)+"/rom")) > + { You could have done #define _GNU_SOURCE before #include to get gnu basename. But what you do is ok too. Its more portable. Applied as is and moved it back to testing. Good job! Thanks! -nc --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---