From: semarie Date: Thu, 15 Oct 2015 15:11:10 +0000 (+0000) Subject: corrects pledge code for fsck_ffs and fsck_ext2fs X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f0426f3aee93beb87ad41c44f4167b5aeb05c9a6;p=openbsd corrects pledge code for fsck_ffs and fsck_ext2fs on filesystem error, fsck will try to display username of inode, resulting need of "getpw" for not SMALL version. add a missed (?) -DSMALL in distrib/special/ for fsck_ffs and fsck_ext2fs found by hard way by ajacoutot@ OK millert@ --- diff --git a/distrib/special/fsck_ext2fs/Makefile b/distrib/special/fsck_ext2fs/Makefile index 1720ac67894..62384f15e6f 100644 --- a/distrib/special/fsck_ext2fs/Makefile +++ b/distrib/special/fsck_ext2fs/Makefile @@ -1,10 +1,10 @@ -# $OpenBSD: Makefile,v 1.1 2014/12/23 17:16:02 deraadt Exp $ +# $OpenBSD: Makefile,v 1.2 2015/10/15 15:11:10 semarie Exp $ PROG= fsck_ext2fs MAN= fsck_ext2fs.8 SRCS= dir.c inode.c main.c pass1.c pass1b.c pass2.c pass3.c pass4.c \ pass5.c fsutil.c setup.c utilities.c ext2fs_bswap.c -CFLAGS+= -I${.CURDIR}/../../../sbin/fsck +CFLAGS+= -I${.CURDIR}/../../../sbin/fsck -DSMALL .PATH: ${.CURDIR}/../../../sbin/fsck_ext2fs .PATH: ${.CURDIR}/../../../sbin/fsck diff --git a/distrib/special/fsck_ffs/Makefile b/distrib/special/fsck_ffs/Makefile index 6fb49e0975c..588e03a83d0 100644 --- a/distrib/special/fsck_ffs/Makefile +++ b/distrib/special/fsck_ffs/Makefile @@ -1,10 +1,10 @@ -# $OpenBSD: Makefile,v 1.1 2014/12/23 17:16:02 deraadt Exp $ +# $OpenBSD: Makefile,v 1.2 2015/10/15 15:11:10 semarie Exp $ PROG= fsck_ffs MAN= fsck_ffs.8 SRCS= dir.c inode.c main.c pass1.c pass1b.c pass2.c pass3.c pass4.c \ pass5.c fsutil.c setup.c utilities.c ffs_subr.c ffs_tables.c -CFLAGS+= -I${.CURDIR}/../../../sbin/fsck +CFLAGS+= -I${.CURDIR}/../../../sbin/fsck -DSMALL DPADD+= ${LIBUTIL} LDADD+= -lutil diff --git a/sbin/fsck_ext2fs/setup.c b/sbin/fsck_ext2fs/setup.c index b709fc0da55..69800d6e45c 100644 --- a/sbin/fsck_ext2fs/setup.c +++ b/sbin/fsck_ext2fs/setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setup.c,v 1.28 2015/10/14 16:58:55 deraadt Exp $ */ +/* $OpenBSD: setup.c,v 1.29 2015/10/15 15:11:10 semarie Exp $ */ /* $NetBSD: setup.c,v 1.1 1997/06/11 11:22:01 bouyer Exp $ */ /* @@ -113,8 +113,13 @@ setup(char *dev) secsize = DEV_BSIZE; if (!hotroot()) { +#ifndef SMALL + if (pledge("stdio getpw", NULL) == -1) + err(1, "pledge"); +#else if (pledge("stdio", NULL) == -1) err(1, "pledge"); +#endif } /* diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index 9c0e40c0daa..1a81f6056ca 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setup.c,v 1.58 2015/10/14 16:58:55 deraadt Exp $ */ +/* $OpenBSD: setup.c,v 1.59 2015/10/15 15:11:10 semarie Exp $ */ /* $NetBSD: setup.c,v 1.27 1996/09/27 22:45:19 christos Exp $ */ /* @@ -141,8 +141,13 @@ setup(char *dev) secsize = DEV_BSIZE; if (!hotroot()) { +#ifndef SMALL + if (pledge("stdio getpw", NULL) == -1) + err(1, "pledge"); +#else if (pledge("stdio", NULL) == -1) err(1, "pledge"); +#endif } /*