fixes for problems found by bionic build

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2016-03-14 18:23:33 +01:00
parent 1b7c17391d
commit dbb58a3879
2 changed files with 28 additions and 18 deletions

View File

@ -142,14 +142,18 @@
# include <netinet/in.h> # include <netinet/in.h>
#else #else
# include <arpa/inet.h> # include <arpa/inet.h>
# if !defined(__socklen_t_defined) && !defined(_SOCKLEN_T_DECLARED) //This breaks on bionic:
/* We #define socklen_t *after* includes, otherwise we get //# if !defined(__socklen_t_defined) && !defined(_SOCKLEN_T_DECLARED)
* typedef redefinition errors from system headers ///* We #define socklen_t *after* includes, otherwise we get
* (in case "is it defined already" detection above failed) // * typedef redefinition errors from system headers
*/ // * (in case "is it defined already" detection above failed)
# define socklen_t bb_socklen_t // */
typedef unsigned socklen_t; //# define socklen_t bb_socklen_t
# endif // typedef unsigned socklen_t;
//# endif
//if this is still needed, add a fix along the lines of
// ifdef SPECIFIC_BROKEN_LIBC_CHECK / typedef socklen_t / endif
//in platform.h instead!
#endif #endif
#ifndef HAVE_CLEARENV #ifndef HAVE_CLEARENV
# define clearenv() do { if (environ) environ[0] = NULL; } while (0) # define clearenv() do { if (environ) environ[0] = NULL; } while (0)

View File

@ -25,23 +25,19 @@
#include <sys/mount.h> #include <sys/mount.h>
#include "libbb.h" #include "libbb.h"
#if ENABLE_FEATURE_EJECT_SCSI
/* Must be after libbb.h: they need size_t */ /* Must be after libbb.h: they need size_t */
#include "fix_u32.h" # include "fix_u32.h"
#include <scsi/sg.h> # include <scsi/sg.h>
#include <scsi/scsi.h> # include <scsi/scsi.h>
#endif
/* various defines swiped from linux/cdrom.h */
#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
#define CDROMEJECT 0x5309 /* Ejects the cdrom media */
#define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
/* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */
#define CDS_TRAY_OPEN 2
#define dev_fd 3 #define dev_fd 3
/* Code taken from the original eject (http://eject.sourceforge.net/), /* Code taken from the original eject (http://eject.sourceforge.net/),
* refactored it a bit for busybox (ne-bb@nicoerfurth.de) */ * refactored it a bit for busybox (ne-bb@nicoerfurth.de) */
#if ENABLE_FEATURE_EJECT_SCSI
static void eject_scsi(const char *dev) static void eject_scsi(const char *dev)
{ {
static const char sg_commands[3][6] = { static const char sg_commands[3][6] = {
@ -76,6 +72,16 @@ static void eject_scsi(const char *dev)
/* force kernel to reread partition table when new disc is inserted */ /* force kernel to reread partition table when new disc is inserted */
ioctl(dev_fd, BLKRRPART); ioctl(dev_fd, BLKRRPART);
} }
#else
# define eject_scsi() ((void)0)
#endif
/* various defines swiped from linux/cdrom.h */
#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
#define CDROMEJECT 0x5309 /* Ejects the cdrom media */
#define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
/* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */
#define CDS_TRAY_OPEN 2
#define FLAG_CLOSE 1 #define FLAG_CLOSE 1
#define FLAG_SMART 2 #define FLAG_SMART 2