Skip to contentSkip to conversation

alsa-utils check if __USE_BSD is defined before compiling "BSD functions"

PATCH In review Hans-Christian Egtvedt 2 participants 4 messages Dec 8, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alsa-utils check if __USE_BSD is defined before compiling "BSD functions"

Hi,

Another bug/issue I tripped over when compiling alsa-utils in an environment using uClibc to supply the C library functions. Here I have enabled some old BSD style functions. The attached patch will honor them if they are enabled.

Without this patch I get a redefined error during compile.

Signature · 2 lines
Best regards,
Hans-Christian Egtvedt
alsactl/init_sysdeps.c +1 -1
Index: alsa-utils-1.0.18/alsactl/init_sysdeps.c
===================================================================
@@ -17,7 +17,7 @@
  *
  */
 
-#ifdef __GLIBC__
+#if defined(__GLIBC__) && !defined(__USE_BSD)
 static size_t strlcpy(char *dst, const char *src, size_t size)
 {
 	size_t bytes = 0;

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#1 lore raw

At Mon, 8 Dec 2008 07:26:02 +0100,

Quoted 9 lines · Hans-Christian Egtvedt

Hi,

Another bug/issue I tripped over when compiling alsa-utils in an environment using uClibc to supply the C library functions. Here I have enabled some old BSD style functions. The attached patch will honor them if they are enabled.

Without this patch I get a redefined error during compile.

Hmm, but with this patch, I get undefined reference errors :)
alsactl/init_sysfs.c:39: undefined reference to `strlcpy'
....

Checking __USB_BSD seems insufficient, unfortunately.

thanks,

Takashi

Quoted 23 lines
Signature · 6 lines
-- 
Best regards,
Hans-Christian Egtvedt
[2 alsa-utils-1.0.18-check-if-__use_bsd-is-defined.patch <text/x-patch (7bit)>]
Index: alsa-utils-1.0.18/alsactl/init_sysdeps.c
===================================================================
alsactl/init_sysdeps.c +1 -1
@@ -17,7 +17,7 @@
  *
  */
 
-#ifdef __GLIBC__
+#if defined(__GLIBC__) && !defined(__USE_BSD)
 static size_t strlcpy(char *dst, const char *src, size_t size)
 {
 	size_t bytes = 0;

[3 <text/plain; us-ascii (7bit)>]
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw
Quoted 10 lines · On Mon, 08 Dec 2008 08:34:55 +0100 Takashi Iwai <[email protected]> wrote:

At Mon, 8 Dec 2008 07:26:02 +0100,

Quoted 8 lines · Hans-Christian Egtvedt

Hi,

Another bug/issue I tripped over when compiling alsa-utils in an environment using uClibc to supply the C library functions. Here I have enabled some old BSD style functions. The attached patch will honor them if they are enabled.

Quoted 8 lines
Quoted 1 line

Without this patch I get a redefined error during compile.

Hmm, but with this patch, I get undefined reference errors :)
alsactl/init_sysfs.c:39: undefined reference to `strlcpy'
....

Checking __USB_BSD seems insufficient, unfortunately.

Perhaps it should be UCLIBC specific? Something like "&& !(defined(__UCLIBC__) && defined(__USE_BSD))"

Signature · 2 lines
Best regards,
Hans-Christian Egtvedt
#3 lore raw

At Mon, 8 Dec 2008 08:48:48 +0100,

Quoted 20 lines · Hans-Christian Egtvedt
Quoted 16 lines · On Mon, 08 Dec 2008 08:34:55 +0100 Takashi Iwai <[email protected]> wrote:

At Mon, 8 Dec 2008 07:26:02 +0100,

Quoted 9 lines · Hans-Christian Egtvedt

Hi,

Another bug/issue I tripped over when compiling alsa-utils in an environment using uClibc to supply the C library functions. Here I have enabled some old BSD style functions. The attached patch will honor them if they are enabled.

Without this patch I get a redefined error during compile.

Hmm, but with this patch, I get undefined reference errors :)
alsactl/init_sysfs.c:39: undefined reference to `strlcpy'
....

Quoted 5 lines
Quoted 2 lines

Checking __USB_BSD seems insufficient, unfortunately.

Perhaps it should be UCLIBC specific? Something like "&& !(defined(__UCLIBC__) && defined(__USE_BSD))"

Should be fine. This fix is committed now.

Thanks,

Takashi