From 830ea2b69faa81a8b0485a28fc329fd93d67ad46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Fri, 21 Sep 2018 12:37:37 +0200 Subject: Replace deprecated ustat using fstatfs This resolves FTBFS with glibc 2.28 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- kscd/kcompactdisc.cpp | 5 ----- kscd/libwm/include/wm_config.h | 5 ++--- kscd/libwm/plat_hpux.c | 14 +++----------- kscd/libwm/plat_linux.c | 12 +++--------- kscd/libwm/plat_news.c | 6 +++--- kscd/libwm/plat_openbsd.c | 5 ----- kscd/libwm/plat_osf1.c | 6 +++--- kscd/libwm/plat_sun.c | 6 +++--- kscd/libwm/plat_ultrix.c | 6 +++--- 9 files changed, 20 insertions(+), 45 deletions(-) diff --git a/kscd/kcompactdisc.cpp b/kscd/kcompactdisc.cpp index 839a6577..e17fdaa7 100644 --- a/kscd/kcompactdisc.cpp +++ b/kscd/kcompactdisc.cpp @@ -42,11 +42,6 @@ #include #include -/* this is for glibc 2.x which the ust structure in ustat.h not stat.h */ -#ifdef __GLIBC__ -#include -#endif - #ifdef __FreeBSD__ #include #include diff --git a/kscd/libwm/include/wm_config.h b/kscd/libwm/include/wm_config.h index a8c574e6..caf7d17e 100644 --- a/kscd/libwm/include/wm_config.h +++ b/kscd/libwm/include/wm_config.h @@ -263,10 +263,9 @@ /* * There are two alternative ways of checking a device containing a * mounted filesystem. Define BSD_MOUNTTEST for the test using - * getmntent(). Undefine it for using the SVR4 ustat(). + * getmntent(). Undefine it for using the fstatfs(). * I built in the choice, because it's not clear which method should - * be used in Linux. The ustat manpage tells us since 1995, that - * fstat() should be used, but I'm too dumb to do so. + * be used in Linux. */ #define BSD_MOUNTTEST diff --git a/kscd/libwm/plat_hpux.c b/kscd/libwm/plat_hpux.c index a7d3c551..ef722437 100644 --- a/kscd/libwm/plat_hpux.c +++ b/kscd/libwm/plat_hpux.c @@ -30,22 +30,14 @@ #include #include #include -#include #include #include #include #include +#include #include "include/wm_config.h" -/* - * this is for glibc 2.x which the ust structure in - * ustat.h not stat.h - */ -#ifdef __GLIBC__ -#include -#endif - #include #include @@ -294,13 +286,13 @@ int gen_eject( struct wm_drive *d ) { struct stat stbuf; - struct ustat ust; + struct statfs sfsbuf; if (fstat(d->fd, &stbuf) != 0) return (-2); /* Is this a mounted filesystem? */ - if (ustat(stbuf.st_rdev, &ust) == 0) + if (fstatfs(d->fd, &sfsbuf) == 0) return (-3); return (wm_scsi2_eject(d)); diff --git a/kscd/libwm/plat_linux.c b/kscd/libwm/plat_linux.c index 6ca8b578..84f2b6cd 100644 --- a/kscd/libwm/plat_linux.c +++ b/kscd/libwm/plat_linux.c @@ -58,13 +58,7 @@ typedef unsigned long long __u64; #if defined(BSD_MOUNTTEST) #include #else - /* - * this is for glibc 2.x which defines ust structure in - * ustat.h not stat.h - */ - #ifdef __GLIBC__ - #include - #endif + #include #endif @@ -604,7 +598,7 @@ gen_eject(struct wm_drive *d) { struct stat stbuf; #if !defined(BSD_MOUNTTEST) - struct ustat ust; + struct statfs sfsbuf; #else struct mntent *mnt; FILE *fp; @@ -619,7 +613,7 @@ gen_eject(struct wm_drive *d) /* Is this a mounted filesystem? */ #if !defined(BSD_MOUNTTEST) - if (ustat(stbuf.st_rdev, &ust) == 0) + if (fstatfs(d->fd, &sfsbuf) == 0) return (-3); #else /* diff --git a/kscd/libwm/plat_news.c b/kscd/libwm/plat_news.c index 73d66228..88300cd3 100644 --- a/kscd/libwm/plat_news.c +++ b/kscd/libwm/plat_news.c @@ -32,11 +32,11 @@ static char plat_news_id[] = "$Id$"; #include #include #include -#include #include #include #include #include +#include #include #include "include/wm_config.h" @@ -362,13 +362,13 @@ int gen_eject( struct wm_drive *d ) { struct stat stbuf; - struct ustat ust; + struct statfs sfsbuf; if (fstat(d->fd, &stbuf) != 0) return (-2); /* Is this a mounted filesystem? */ - if (ustat(stbuf.st_rdev, &ust) == 0) + if (fstatfs(d->fd, &sfsbuf) == 0) return (-3); if (CD_AutoEject(d->fd)) diff --git a/kscd/libwm/plat_openbsd.c b/kscd/libwm/plat_openbsd.c index 7ee1100d..b85cdcaf 100644 --- a/kscd/libwm/plat_openbsd.c +++ b/kscd/libwm/plat_openbsd.c @@ -45,11 +45,6 @@ #include "include/wm_cdrom.h" #include "include/wm_helpers.h" -/* this is for glibc 2.x which defines the ust structure in ustat.h not stat.h */ -#ifdef __GLIBC__ -#include -#endif - #include #include #include diff --git a/kscd/libwm/plat_osf1.c b/kscd/libwm/plat_osf1.c index accf1f81..2ccfc49c 100644 --- a/kscd/libwm/plat_osf1.c +++ b/kscd/libwm/plat_osf1.c @@ -33,8 +33,8 @@ #include #include #include +#include #include -#include #include /* #include #include */ @@ -424,13 +424,13 @@ gen_eject(struct wm_drive *d) { /* On some systems, we can check to see if the CD is mounted. */ struct stat stbuf; - struct ustat ust; + struct statfs sfsbuf; if (fstat(d->fd, &stbuf) != 0) return (-2); /* Is this a mounted filesystem? */ - if (ustat(stbuf.st_rdev, &ust) == 0) + if (fstatfs(d->fd, &sfsbuf) == 0) return (-3); return (ioctl(d->fd, CDROM_EJECT_CADDY, 0)); diff --git a/kscd/libwm/plat_sun.c b/kscd/libwm/plat_sun.c index 80ce3567..bb87a8e2 100644 --- a/kscd/libwm/plat_sun.c +++ b/kscd/libwm/plat_sun.c @@ -36,6 +36,7 @@ static char plat_sun_id[] = "$Id$"; #include #include #include +#include #include #include @@ -44,7 +45,6 @@ static char plat_sun_id[] = "$Id$"; #include "include/wm_cdrom.h" #include "include/wm_cdtext.h" -#include #include #include #ifdef solbourne @@ -602,13 +602,13 @@ int gen_eject( struct wm_drive *d ) { struct stat stbuf; - struct ustat ust; + struct statfs sfsbuf; if (fstat(d->fd, &stbuf) != 0) return (-2); /* Is this a mounted filesystem? */ - if (ustat(stbuf.st_rdev, &ust) == 0) + if (fstatfs(d->fd, &sfsbuf) == 0) return (-3); IFCDDA(d) { diff --git a/kscd/libwm/plat_ultrix.c b/kscd/libwm/plat_ultrix.c index 010055d0..735c6f79 100644 --- a/kscd/libwm/plat_ultrix.c +++ b/kscd/libwm/plat_ultrix.c @@ -36,8 +36,8 @@ static char plat_ultrix_id[] = "$Id$"; #include #include #include +#include #include -#include #include #include #include @@ -475,13 +475,13 @@ gen_eject(struct wm_drive *d) { /* On some systems, we can check to see if the CD is mounted. */ struct stat stbuf; - struct ustat ust; + struct statfs sfsbuf; if (fstat(d->fd, &stbuf) != 0) return (-2); /* Is this a mounted filesystem? */ - if (ustat(stbuf.st_rdev, &ust) == 0) + if (fstatfs(d->fd, &sfsbuf) == 0) return (-3); return (ioctl(d->fd, CDROM_EJECT_CADDY)); -- cgit v1.2.3