aboutsummaryrefslogtreecommitdiffstats
path: root/sbin/fsck
diff options
context:
space:
mode:
authorUlrich Spörlein <uqs@FreeBSD.org>2012-10-21 12:01:19 +0000
committerUlrich Spörlein <uqs@FreeBSD.org>2012-10-21 12:01:19 +0000
commit3bbc4438c9bd4b0294a8c5ce5253e3ffe3189cf9 (patch)
tree51a66e358e4c5579ab65ee6198ef02fdd1437244 /sbin/fsck
parent6cf357bc6c6733e9f478f5b2a0b5ff413459a876 (diff)
downloadsrc-3bbc4438c9bd4b0294a8c5ce5253e3ffe3189cf9.tar.gz
src-3bbc4438c9bd4b0294a8c5ce5253e3ffe3189cf9.zip
Make fsck and fsck_msdosfs WARNS=6 clean
- sprinkle const - add volatile qualifier to avoid vfork clobbering Inspired by: NetBSD PR: bin/139802 Reviewed by: ed
Notes
Notes: svn path=/head/; revision=241807
Diffstat (limited to 'sbin/fsck')
-rw-r--r--sbin/fsck/Makefile1
-rw-r--r--sbin/fsck/fsck.c17
-rw-r--r--sbin/fsck/fsutil.h2
-rw-r--r--sbin/fsck/preen.c6
4 files changed, 13 insertions, 13 deletions
diff --git a/sbin/fsck/Makefile b/sbin/fsck/Makefile
index bc445fda26f7..22de03c4da78 100644
--- a/sbin/fsck/Makefile
+++ b/sbin/fsck/Makefile
@@ -3,7 +3,6 @@
PROG= fsck
SRCS= fsck.c fsutil.c preen.c
-WARNS?= 2
MAN= fsck.8
.include <bsd.prog.mk>
diff --git a/sbin/fsck/fsck.c b/sbin/fsck/fsck.c
index 9812b658d3e2..6bc702e90280 100644
--- a/sbin/fsck/fsck.c
+++ b/sbin/fsck/fsck.c
@@ -73,14 +73,14 @@ static char *options = NULL;
static int flags = 0;
static int forceflag = 0;
-static int checkfs(const char *, const char *, const char *, char *, pid_t *);
+static int checkfs(const char *, const char *, const char *, const char *, pid_t *);
static int selected(const char *);
static void addoption(char *);
static const char *getoptions(const char *);
static void addentry(struct fstypelist *, const char *, const char *);
static void maketypelist(char *);
static void catopt(char **, const char *);
-static void mangle(char *, int *, const char ***, int *);
+static void mangle(char *, int *, const char ** volatile *, int *);
static const char *getfslab(const char *);
static void usage(void) __dead2;
static int isok(struct fstab *);
@@ -187,6 +187,7 @@ main(int argc, char *argv[])
char device[MAXPATHLEN];
struct statfs *mntp;
+ mntpt = NULL;
spec = *argv;
cp = strrchr(spec, '/');
if (cp == 0) {
@@ -285,9 +286,9 @@ isok(struct fstab *fs)
static int
checkfs(const char *pvfstype, const char *spec, const char *mntpt,
- char *auxopt, pid_t *pidp)
+ const char *auxopt, pid_t *pidp)
{
- const char **argv;
+ const char ** volatile argv;
pid_t pid;
int argc, i, status, maxargc;
char *optbuf, execbase[MAXPATHLEN];
@@ -312,7 +313,7 @@ checkfs(const char *pvfstype, const char *spec, const char *mntpt,
vfstype = strdup(pvfstype);
if (vfstype == NULL)
perr("strdup(pvfstype)");
- for (i = 0; i < strlen(vfstype); i++) {
+ for (i = 0; i < (int)strlen(vfstype); i++) {
vfstype[i] = tolower(vfstype[i]);
if (vfstype[i] == ' ')
vfstype[i] = '_';
@@ -361,7 +362,7 @@ checkfs(const char *pvfstype, const char *spec, const char *mntpt,
_exit(0);
/* Go find an executable. */
- execvP(execbase, _PATH_SYSPATH, (char * const *)argv);
+ execvP(execbase, _PATH_SYSPATH, __DECONST(char * const *, argv));
if (spec)
warn("exec %s for %s in %s", execbase, spec, _PATH_SYSPATH);
else
@@ -498,7 +499,7 @@ catopt(char **sp, const char *o)
static void
-mangle(char *opts, int *argcp, const char ***argvp, int *maxargcp)
+mangle(char *opts, int *argcp, const char ** volatile *argvp, int *maxargcp)
{
char *p, *s;
int argc, maxargc;
@@ -535,7 +536,7 @@ mangle(char *opts, int *argcp, const char ***argvp, int *maxargcp)
}
-const static char *
+static const char *
getfslab(const char *str)
{
struct disklabel dl;
diff --git a/sbin/fsck/fsutil.h b/sbin/fsck/fsutil.h
index b1ce6f101314..013b821b29d0 100644
--- a/sbin/fsck/fsutil.h
+++ b/sbin/fsck/fsutil.h
@@ -47,4 +47,4 @@ char *estrdup(const char *);
struct fstab;
int checkfstab(int, int (*)(struct fstab *),
- int (*) (const char *, const char *, const char *, char *, pid_t *));
+ int (*) (const char *, const char *, const char *, const char *, pid_t *));
diff --git a/sbin/fsck/preen.c b/sbin/fsck/preen.c
index 1437e1100695..18f280197895 100644
--- a/sbin/fsck/preen.c
+++ b/sbin/fsck/preen.c
@@ -78,12 +78,12 @@ static int nrun = 0, ndisks = 0;
static struct diskentry *finddisk(const char *);
static void addpart(const char *, const char *, const char *);
static int startdisk(struct diskentry *,
- int (*)(const char *, const char *, const char *, char *, pid_t *));
+ int (*)(const char *, const char *, const char *, const char *, pid_t *));
static void printpart(void);
int
checkfstab(int flags, int (*docheck)(struct fstab *),
- int (*checkit)(const char *, const char *, const char *, char *, pid_t *))
+ int (*checkit)(const char *, const char *, const char *, const char *, pid_t *))
{
struct fstab *fs;
struct diskentry *d, *nextdisk;
@@ -317,7 +317,7 @@ addpart(const char *type, const char *dev, const char *mntpt)
static int
startdisk(struct diskentry *d, int (*checkit)(const char *, const char *,
- const char *, char *, pid_t *))
+ const char *, const char *, pid_t *))
{
struct partentry *p = TAILQ_FIRST(&d->d_part);
int rv;