[Toybox] [PATCH] Shut up GCC 3.4 on musl

Isaac Dunham ibid.ag at gmail.com
Sat Jan 25 17:52:58 PST 2014


Two changes to shut up GCC:
* __GLIBC__ was checked unconditionally; 
this made for a very messy build on musl.
* int fd in chvt is always initialized; GCC 3.4 does not recognize this.

--
If you want to ignore the second part, that's fine.
The first part may need some adjustment so it wraps properly.

Thanks,
Isaac Dunham
-------------- next part --------------
diff --git a/lib/portability.h b/lib/portability.h
index 7557620..86484c7 100644
--- a/lib/portability.h
+++ b/lib/portability.h
@@ -145,7 +145,7 @@ int clearenv(void);
 #define SWAP_LE64(x) (x)
 #endif
 
-#if defined(__APPLE__) || defined(__ANDROID__) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 10)
+#if defined(__APPLE__) || defined(__ANDROID__) || (defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 10)
 ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream);
 ssize_t getline(char **lineptr, size_t *n, FILE *stream);
 #endif
diff --git a/toys/other/chvt.c b/toys/other/chvt.c
index 5016b9b..6544265 100644
--- a/toys/other/chvt.c
+++ b/toys/other/chvt.c
@@ -21,7 +21,7 @@ config CHVT
 
 void chvt_main(void)
 {
-  int vtnum, fd;
+  int vtnum, fd = fd;
   char *consoles[]={"/dev/console", "/dev/vc/0", "/dev/tty", NULL}, **cc;
 
   vtnum=atoi(*toys.optargs);


More information about the Toybox mailing list