aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-03-14 18:23:33 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2016-03-14 18:23:33 +0100
commitdbb58a3879c2daa3e286a8cd9da7935e264f3072 (patch)
treedd79ea5de5b85926f4bea7298a44238f1c221f18
parent1b7c17391de66502dd7a97c866e0a33681edbb1f (diff)
downloadbusybox-w32-dbb58a3879c2daa3e286a8cd9da7935e264f3072.tar.gz
busybox-w32-dbb58a3879c2daa3e286a8cd9da7935e264f3072.tar.bz2
busybox-w32-dbb58a3879c2daa3e286a8cd9da7935e264f3072.zip
fixes for problems found by bionic build
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--include/libbb.h20
-rw-r--r--miscutils/eject.c26
2 files changed, 28 insertions, 18 deletions
diff --git a/include/libbb.h b/include/libbb.h
index d05ac2976..8b226c00c 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -142,14 +142,18 @@
142# include <netinet/in.h> 142# include <netinet/in.h>
143#else 143#else
144# include <arpa/inet.h> 144# include <arpa/inet.h>
145# if !defined(__socklen_t_defined) && !defined(_SOCKLEN_T_DECLARED) 145//This breaks on bionic:
146/* We #define socklen_t *after* includes, otherwise we get 146//# if !defined(__socklen_t_defined) && !defined(_SOCKLEN_T_DECLARED)
147 * typedef redefinition errors from system headers 147///* We #define socklen_t *after* includes, otherwise we get
148 * (in case "is it defined already" detection above failed) 148// * typedef redefinition errors from system headers
149 */ 149// * (in case "is it defined already" detection above failed)
150# define socklen_t bb_socklen_t 150// */
151 typedef unsigned socklen_t; 151//# define socklen_t bb_socklen_t
152# endif 152// typedef unsigned socklen_t;
153//# endif
154//if this is still needed, add a fix along the lines of
155// ifdef SPECIFIC_BROKEN_LIBC_CHECK / typedef socklen_t / endif
156//in platform.h instead!
153#endif 157#endif
154#ifndef HAVE_CLEARENV 158#ifndef HAVE_CLEARENV
155# define clearenv() do { if (environ) environ[0] = NULL; } while (0) 159# define clearenv() do { if (environ) environ[0] = NULL; } while (0)
diff --git a/miscutils/eject.c b/miscutils/eject.c
index a20e04b7f..15eaf556d 100644
--- a/miscutils/eject.c
+++ b/miscutils/eject.c
@@ -25,23 +25,19 @@
25 25
26#include <sys/mount.h> 26#include <sys/mount.h>
27#include "libbb.h" 27#include "libbb.h"
28#if ENABLE_FEATURE_EJECT_SCSI
28/* Must be after libbb.h: they need size_t */ 29/* Must be after libbb.h: they need size_t */
29#include "fix_u32.h" 30# include "fix_u32.h"
30#include <scsi/sg.h> 31# include <scsi/sg.h>
31#include <scsi/scsi.h> 32# include <scsi/scsi.h>
32 33#endif
33/* various defines swiped from linux/cdrom.h */
34#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
35#define CDROMEJECT 0x5309 /* Ejects the cdrom media */
36#define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
37/* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */
38#define CDS_TRAY_OPEN 2
39 34
40#define dev_fd 3 35#define dev_fd 3
41 36
42/* Code taken from the original eject (http://eject.sourceforge.net/), 37/* Code taken from the original eject (http://eject.sourceforge.net/),
43 * refactored it a bit for busybox (ne-bb@nicoerfurth.de) */ 38 * refactored it a bit for busybox (ne-bb@nicoerfurth.de) */
44 39
40#if ENABLE_FEATURE_EJECT_SCSI
45static void eject_scsi(const char *dev) 41static void eject_scsi(const char *dev)
46{ 42{
47 static const char sg_commands[3][6] = { 43 static const char sg_commands[3][6] = {
@@ -76,6 +72,16 @@ static void eject_scsi(const char *dev)
76 /* force kernel to reread partition table when new disc is inserted */ 72 /* force kernel to reread partition table when new disc is inserted */
77 ioctl(dev_fd, BLKRRPART); 73 ioctl(dev_fd, BLKRRPART);
78} 74}
75#else
76# define eject_scsi() ((void)0)
77#endif
78
79/* various defines swiped from linux/cdrom.h */
80#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
81#define CDROMEJECT 0x5309 /* Ejects the cdrom media */
82#define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
83/* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */
84#define CDS_TRAY_OPEN 2
79 85
80#define FLAG_CLOSE 1 86#define FLAG_CLOSE 1
81#define FLAG_SMART 2 87#define FLAG_SMART 2