Changeset View
Changeset View
Standalone View
Standalone View
sbin/fsck_msdosfs/check.c
Show All 27 Lines | |||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
#ifndef lint | #ifndef lint | ||||
__RCSID("$NetBSD: check.c,v 1.14 2006/06/05 16:51:18 christos Exp $"); | __RCSID("$NetBSD: check.c,v 1.14 2006/06/05 16:51:18 christos Exp $"); | ||||
static const char rcsid[] = | static const char rcsid[] = | ||||
"$FreeBSD$"; | "$FreeBSD$"; | ||||
#endif /* not lint */ | #endif /* not lint */ | ||||
#ifdef HAVE_CAPSICUM | |||||
markj: Style, missing a space after #include.
We also don't need the blank line between this and the… | |||||
#include<capsicum_helpers.h> | |||||
#endif | |||||
#ifdef HAVE_LIBUTIL_H | #ifdef HAVE_LIBUTIL_H | ||||
Not Done Inline ActionsJudging from this #ifdef I guess we'll want an explicit #ifdef HAVE_CASPER rather than relying on capsicum_helpers? markj: Judging from this #ifdef I guess we'll want an explicit #ifdef HAVE_CASPER rather than relying… | |||||
#include <libutil.h> | #include <libutil.h> | ||||
#endif | #endif | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#include "ext.h" | #include "ext.h" | ||||
#include "fsutil.h" | #include "fsutil.h" | ||||
int | int | ||||
checkfilesys(const char *fname) | checkfilesys(const char *fname) | ||||
Not Done Inline ActionsLook at how this function is called in main(). If multiple filesystems are passed on the command line, with this patch we will fail after the first. You would need to use cap_fileargs to open them. markj: Look at how this function is called in main(). If multiple filesystems are passed on the… | |||||
{ | { | ||||
int dosfs; | int dosfs; | ||||
struct bootblock boot; | struct bootblock boot; | ||||
struct fat_descriptor *fat = NULL; | struct fat_descriptor *fat = NULL; | ||||
int finish_dosdirsection=0; | int finish_dosdirsection=0; | ||||
int mod = 0; | int mod = 0; | ||||
int ret = 8; | int ret = 8; | ||||
int64_t freebytes; | int64_t freebytes; | ||||
int64_t badbytes; | int64_t badbytes; | ||||
rdonly = alwaysno; | rdonly = alwaysno; | ||||
if (!preen) | if (!preen) | ||||
printf("** %s", fname); | printf("** %s", fname); | ||||
dosfs = open(fname, rdonly ? O_RDONLY : O_RDWR, 0); | dosfs = open(fname, rdonly ? O_RDONLY : O_RDWR, 0); | ||||
Not Done Inline ActionsWe don't need this else part. The fileargs_open will be converted to normal open if capser is unavilable. oshogbo: We don't need this else part. The fileargs_open will be converted to normal open if capser is… | |||||
#ifdef HAVE_CAPSICUM | |||||
/* | |||||
* Here we enter capability mode. Further down access to global | |||||
* namespaces (e.g filesystem) is restricted (see capsicum(4)). | |||||
* We must connect(2) our socket before this point. | |||||
*/ | |||||
if (caph_enter() < 0) { | |||||
fprintf(stderr, "caph_enter_casper: %s\n", strerror(errno)); | |||||
exit(1); | |||||
} | |||||
#endif | |||||
if (dosfs < 0 && !rdonly) { | if (dosfs < 0 && !rdonly) { | ||||
dosfs = open(fname, O_RDONLY, 0); | dosfs = open(fname, O_RDONLY, 0); | ||||
markjUnsubmitted Not Done Inline ActionsThis open() will always fail now. markj: This open() will always fail now. | |||||
if (dosfs >= 0) | if (dosfs >= 0) | ||||
pwarn(" (NO WRITE)\n"); | pwarn(" (NO WRITE)\n"); | ||||
else if (!preen) | else if (!preen) | ||||
printf("\n"); | printf("\n"); | ||||
rdonly = 1; | rdonly = 1; | ||||
} else if (!preen) | } else if (!preen) | ||||
printf("\n"); | printf("\n"); | ||||
▲ Show 20 Lines • Show All 119 Lines • Show Last 20 Lines |
Style, missing a space after #include.
We also don't need the blank line between this and the rest of the includes.