From f6e0ec6e2df64ce90e3a52a3e636f3ffb5c38927 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Wed, 3 Aug 2005 09:11:06 +0000 Subject: [PATCH] fix --- ChangeLog | 11 +++++++-- configure.in | 4 +++- example/hello_ll.c | 2 +- example/null.c | 26 ++++++++++++++------- include/fuse.h | 6 ++--- include/fuse_lowlevel.h | 6 ++--- kernel/dir.c | 4 ++-- lib/fuse.c | 46 ++++++++++++++++++------------------- lib/fuse_lowlevel.c | 50 ++++++++++++++++++++--------------------- lib/fuse_lowlevel_mt.c | 2 +- lib/fuse_mt.c | 4 ++-- lib/helper.c | 19 ++++++++-------- lib/mount.c | 2 +- util/fusermount.c | 20 ++++++++--------- 14 files changed, 111 insertions(+), 91 deletions(-) diff --git a/ChangeLog b/ChangeLog index 16ed905..8d8e1f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,17 @@ +2005-08-03 Miklos Szeredi + + * fix warnings in fuse.h and fuse_lowlevel.h if -Wshadow compiler + option is used (Paul Alfille). + 2005-08-02 Miklos Szeredi * highlevel-lib: added mount options "attr_timeout" and "entry_timeout". These options control the length of time file attributes and entries (names) are cached. Both default to 1.0 second. - + + * kernel: correctly handle zero timeout for attributes and entries + 2005-08-01 Miklos Szeredi * Added missing symbols to versionscript (Joshua J. Berry) @@ -27,7 +34,7 @@ newly created * lib (highlevel): make open method optional - + 2005-07-28 Miklos Szeredi * kernel: invalidate attributes for read/readdir/readlink diff --git a/configure.in b/configure.in index 3055b01..4a5a493 100644 --- a/configure.in +++ b/configure.in @@ -13,7 +13,9 @@ if test -z "$mkdir_p"; then AC_SUBST(mkdir_p) fi -CFLAGS="-Wall -W -g -O2" +if test -z "$CFLAGS"; then + CFLAGS="-Wall -W -g -O2" +fi CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DFUSE_USE_VERSION=22" AC_ARG_ENABLE(kernel-module, diff --git a/example/hello_ll.c b/example/hello_ll.c index 9f70865..3a6ea09 100644 --- a/example/hello_ll.c +++ b/example/hello_ll.c @@ -78,7 +78,7 @@ static void dirbuf_add(struct dirbuf *b, const char *name, fuse_ino_t ino) struct stat stbuf; size_t oldsize = b->size; b->size += fuse_dirent_size(strlen(name)); - b->p = realloc(b->p, b->size); + b->p = (char *) realloc(b->p, b->size); memset(&stbuf, 0, sizeof(stbuf)); stbuf.st_ino = ino; fuse_add_dirent(b->p + oldsize, name, &stbuf, b->size); diff --git a/example/null.c b/example/null.c index d58feab..d9539ab 100644 --- a/example/null.c +++ b/example/null.c @@ -12,8 +12,6 @@ #include #include -#define UNUSED(x) x __attribute__((unused)) - static int null_getattr(const char *path, struct stat *stbuf) { if(strcmp(path, "/") != 0) @@ -30,34 +28,46 @@ static int null_getattr(const char *path, struct stat *stbuf) return 0; } -static int null_truncate(const char *path, off_t UNUSED(size)) +static int null_truncate(const char *path, off_t size) { + (void) size; + if(strcmp(path, "/") != 0) return -ENOENT; return 0; } -static int null_open(const char *path, struct fuse_file_info *UNUSED(fi)) +static int null_open(const char *path, struct fuse_file_info *fi) { + (void) fi; + if(strcmp(path, "/") != 0) return -ENOENT; return 0; } -static int null_read(const char *path, char *UNUSED(buf), size_t size, - off_t UNUSED(offset), struct fuse_file_info *UNUSED(fi)) +static int null_read(const char *path, char *buf, size_t size, + off_t offset, struct fuse_file_info *fi) { + (void) buf; + (void) offset; + (void) fi; + if(strcmp(path, "/") != 0) return -ENOENT; return size; } -static int null_write(const char *path, const char *UNUSED(buf), size_t size, - off_t UNUSED(offset), struct fuse_file_info *UNUSED(fi)) +static int null_write(const char *path, const char *buf, size_t size, + off_t offset, struct fuse_file_info *fi) { + (void) buf; + (void) offset; + (void) fi; + if(strcmp(path, "/") != 0) return -ENOENT; diff --git a/include/fuse.h b/include/fuse.h index db9a417..ade49f5 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -58,7 +58,7 @@ struct fuse; * @return 1 if buffer is full, zero otherwise */ typedef int (*fuse_fill_dir_t) (void *buf, const char *name, - const struct stat *stat, off_t off); + const struct stat *stbuf, off_t off); /* Used by deprecated getdir() method */ typedef struct fuse_dirhandle *fuse_dirh_t; @@ -148,7 +148,7 @@ struct fuse_operations { * with the given flags. In fact it cannot correctly do that * since it doesn't have a way to determine if the file was just * created (and hence the permission need not be checked). - * + * * If permission needs to be checked, implement the access() * method, and do the check there. * @@ -313,7 +313,7 @@ struct fuse_operations { /** * Check file access permissions - * + * * Need not be implemented. Will only be called for the access() * system call, and for the open() system call, unless a new file * is created (file didn't exist and O_CREAT was given). If the diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index 16257a9..8b18959 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -115,7 +115,7 @@ struct fuse_ll_operations { size_t size); void (*listxattr)(fuse_req_t req, fuse_ino_t ino, size_t size); void (*removexattr)(fuse_req_t req, fuse_ino_t ino, const char *name); - void (*getlk) (fuse_req_t req, fuse_ino_t ino, + void (*getlk) (fuse_req_t req, fuse_ino_t ino, const struct fuse_lock_param *lk); void (*setlk) (fuse_req_t req, fuse_ino_t ino, int sleep, const struct fuse_lock_param *lk); @@ -149,7 +149,7 @@ int fuse_reply_write(fuse_req_t req, size_t count); int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size); /* statfs */ -int fuse_reply_statfs(fuse_req_t req, const struct statfs *statfs); +int fuse_reply_statfs(fuse_req_t req, const struct statfs *stbuf); /* getxattr, listxattr */ int fuse_reply_xattr(fuse_req_t req, size_t count); @@ -163,7 +163,7 @@ int fuse_reply_getlk(fuse_req_t req, const struct fuse_lock_param *lk); size_t fuse_dirent_size(size_t namelen); /* add a directory entry to the buffer */ -char *fuse_add_dirent(char *buf, const char *name, const struct stat *stat, +char *fuse_add_dirent(char *buf, const char *name, const struct stat *stbuf, off_t off); /* ------------------------------------------ */ diff --git a/kernel/dir.c b/kernel/dir.c index a7a6945..f2fe170 100644 --- a/kernel/dir.c +++ b/kernel/dir.c @@ -24,7 +24,7 @@ static inline unsigned long time_to_jiffies(unsigned long sec, unsigned long nsec) { struct timespec ts = {sec, nsec}; - return jiffies + timespec_to_jiffies(&ts); + return jiffies + ((sec || nsec) ? timespec_to_jiffies(&ts) : 0) - 1; } static void fuse_lookup_init(struct fuse_req *req, struct inode *dir, @@ -552,7 +552,7 @@ static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd) return -EACCES; err = 0; - if (nd && + if (nd && ((nd->flags & LOOKUP_ACCESS) || ((nd->flags & LOOKUP_OPEN) && mode != 0))) err = fuse_access(inode, mask); diff --git a/lib/fuse.c b/lib/fuse.c index b3203d2..68eeee0 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -745,7 +745,7 @@ static void fuse_access(fuse_req_t req, fuse_ino_t ino, int mask) static void fuse_readlink(fuse_req_t req, fuse_ino_t ino) { struct fuse *f = req_fuse_prepare(req); - char link[PATH_MAX + 1]; + char linkname[PATH_MAX + 1]; char *path; int err; @@ -755,13 +755,13 @@ static void fuse_readlink(fuse_req_t req, fuse_ino_t ino) if (path != NULL) { err = -ENOSYS; if (f->op.readlink) - err = f->op.readlink(path, link, sizeof(link)); + err = f->op.readlink(path, linkname, sizeof(linkname)); free(path); } pthread_rwlock_unlock(&f->tree_lock); if (!err) { - link[PATH_MAX] = '\0'; - fuse_reply_readlink(req, link); + linkname[PATH_MAX] = '\0'; + fuse_reply_readlink(req, linkname); } else reply_err(req, err); } @@ -878,8 +878,8 @@ static void fuse_rmdir(fuse_req_t req, fuse_ino_t parent, const char *name) reply_err(req, err); } -static void fuse_symlink(fuse_req_t req, const char *link, fuse_ino_t parent, - const char *name) +static void fuse_symlink(fuse_req_t req, const char *linkname, + fuse_ino_t parent, const char *name) { struct fuse *f = req_fuse_prepare(req); struct fuse_entry_param e; @@ -896,7 +896,7 @@ static void fuse_symlink(fuse_req_t req, const char *link, fuse_ino_t parent, } err = -ENOSYS; if (f->op.symlink && f->op.getattr) { - err = f->op.symlink(link, path); + err = f->op.symlink(linkname, path); if (!err) err = lookup_path(f, parent, name, path, &e); } @@ -1253,7 +1253,7 @@ static void fuse_opendir(fuse_req_t req, fuse_ino_t ino, } static int fill_dir_common(struct fuse_dirhandle *dh, const char *name, - const struct stat *stat, off_t off) + const struct stat *statp, off_t off) { struct stat stbuf; unsigned namelen = strlen(name); @@ -1261,11 +1261,11 @@ static int fill_dir_common(struct fuse_dirhandle *dh, const char *name, unsigned newlen; char *newptr; - if (stat) - stbuf = *stat; + if (statp) + stbuf = *statp; else { memset(&stbuf, 0, sizeof(stbuf)); - stbuf.st_ino = -1; + stbuf.st_ino = (ino_t) -1; } if (!(dh->fuse->flags & FUSE_USE_INO)) { @@ -1289,7 +1289,7 @@ static int fill_dir_common(struct fuse_dirhandle *dh, const char *name, return 1; } - newptr = realloc(dh->contents, newlen); + newptr = (char *) realloc(dh->contents, newlen); if (!newptr) { dh->error = -ENOMEM; return 1; @@ -1300,10 +1300,10 @@ static int fill_dir_common(struct fuse_dirhandle *dh, const char *name, return 0; } -static int fill_dir(void *buf, const char *name, const struct stat *stat, +static int fill_dir(void *buf, const char *name, const struct stat *stbuf, off_t off) { - return fill_dir_common((struct fuse_dirhandle *) buf, name, stat, off); + return fill_dir_common((struct fuse_dirhandle *) buf, name, stbuf, off); } static int fill_dir_old(struct fuse_dirhandle *dh, const char *name, int type, @@ -1431,15 +1431,15 @@ static int default_statfs(struct statfs *buf) } static void convert_statfs_compat(struct fuse_statfs_compat1 *compatbuf, - struct statfs *statfs) + struct statfs *stbuf) { - statfs->f_bsize = compatbuf->block_size; - statfs->f_blocks = compatbuf->blocks; - statfs->f_bfree = compatbuf->blocks_free; - statfs->f_bavail = compatbuf->blocks_free; - statfs->f_files = compatbuf->files; - statfs->f_ffree = compatbuf->files_free; - statfs->f_namelen = compatbuf->namelen; + stbuf->f_bsize = compatbuf->block_size; + stbuf->f_blocks = compatbuf->blocks; + stbuf->f_bfree = compatbuf->blocks_free; + stbuf->f_bavail = compatbuf->blocks_free; + stbuf->f_files = compatbuf->files; + stbuf->f_ffree = compatbuf->files_free; + stbuf->f_namelen = compatbuf->namelen; } static void fuse_statfs(fuse_req_t req) @@ -1870,7 +1870,7 @@ struct fuse *fuse_new_compat2(int fd, const char *opts, struct fuse *fuse_new_compat1(int fd, int flags, const struct fuse_operations_compat1 *op) { - char *opts = NULL; + const char *opts = NULL; if (flags & FUSE_DEBUG_COMPAT1) opts = "debug"; return fuse_new_common(fd, opts, (struct fuse_operations *) op, diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 9df0e09..fce1d6d 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -225,7 +225,7 @@ size_t fuse_dirent_size(size_t namelen) return FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + namelen); } -char *fuse_add_dirent(char *buf, const char *name, const struct stat *stat, +char *fuse_add_dirent(char *buf, const char *name, const struct stat *stbuf, off_t off) { unsigned namelen = strlen(name); @@ -234,10 +234,10 @@ char *fuse_add_dirent(char *buf, const char *name, const struct stat *stat, unsigned padlen = entsize - entlen; struct fuse_dirent *dirent = (struct fuse_dirent *) buf; - dirent->ino = stat->st_ino; + dirent->ino = stbuf->st_ino; dirent->off = off; dirent->namelen = namelen; - dirent->type = (stat->st_mode & 0170000) >> 12; + dirent->type = (stbuf->st_mode & 0170000) >> 12; strncpy(dirent->name, name, namelen); if (padlen) memset(buf + entlen, 0, padlen); @@ -245,16 +245,16 @@ char *fuse_add_dirent(char *buf, const char *name, const struct stat *stat, return buf + entsize; } -static void convert_statfs(const struct statfs *statfs, +static void convert_statfs(const struct statfs *stbuf, struct fuse_kstatfs *kstatfs) { - kstatfs->bsize = statfs->f_bsize; - kstatfs->blocks = statfs->f_blocks; - kstatfs->bfree = statfs->f_bfree; - kstatfs->bavail = statfs->f_bavail; - kstatfs->files = statfs->f_files; - kstatfs->ffree = statfs->f_ffree; - kstatfs->namelen = statfs->f_namelen; + kstatfs->bsize = stbuf->f_bsize; + kstatfs->blocks = stbuf->f_blocks; + kstatfs->bfree = stbuf->f_bfree; + kstatfs->bavail = stbuf->f_bavail; + kstatfs->files = stbuf->f_files; + kstatfs->ffree = stbuf->f_ffree; + kstatfs->namelen = stbuf->f_namelen; } static void free_req(fuse_req_t req) @@ -332,9 +332,9 @@ int fuse_reply_attr(fuse_req_t req, const struct stat *attr, return send_reply_req(req, &arg, sizeof(arg)); } -int fuse_reply_readlink(fuse_req_t req, const char *link) +int fuse_reply_readlink(fuse_req_t req, const char *linkname) { - return send_reply_req(req, link, strlen(link)); + return send_reply_req(req, linkname, strlen(linkname)); } int fuse_reply_open(fuse_req_t req, const struct fuse_file_info *f) @@ -366,12 +366,12 @@ int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size) return send_reply_req(req, buf, size); } -int fuse_reply_statfs(fuse_req_t req, const struct statfs *statfs) +int fuse_reply_statfs(fuse_req_t req, const struct statfs *stbuf) { struct fuse_statfs_out arg; memset(&arg, 0, sizeof(arg)); - convert_statfs(statfs, &arg.st); + convert_statfs(stbuf, &arg.st); return send_reply_req(req, &arg, sizeof(arg)); } @@ -389,10 +389,10 @@ int fuse_reply_xattr(fuse_req_t req, size_t count) int fuse_reply_getlk(fuse_req_t req, const struct fuse_lock_param *lk) { struct fuse_lk_in_out arg; - + memset(&arg, 0, sizeof(arg)); convert_lock_param(lk, &arg.lk); - + return send_reply_req(req, &arg, sizeof(arg)); } @@ -482,10 +482,10 @@ static void do_rmdir(fuse_req_t req, fuse_ino_t nodeid, char *name) } static void do_symlink(fuse_req_t req, fuse_ino_t nodeid, char *name, - char *link) + char *linkname) { if (req->f->op.symlink) - req->f->op.symlink(req, link, nodeid, name); + req->f->op.symlink(req, linkname, nodeid, name); else fuse_reply_err(req, ENOSYS); } @@ -706,7 +706,7 @@ static void do_getlk(fuse_req_t req, fuse_ino_t nodeid, { if (req->f->op.getlk) { struct fuse_lock_param lk; - + memset(&lk, 0, sizeof(lk)); convert_file_lock(&arg->lk, &lk); req->f->op.getlk(req, nodeid, &lk); @@ -714,15 +714,15 @@ static void do_getlk(fuse_req_t req, fuse_ino_t nodeid, fuse_reply_err(req, ENOSYS); } -static void do_setlk(fuse_req_t req, fuse_ino_t nodeid, int sleep, +static void do_setlk(fuse_req_t req, fuse_ino_t nodeid, int issleep, struct fuse_lk_in_out *arg) { if (req->f->op.setlk) { struct fuse_lock_param lk; - + memset(&lk, 0, sizeof(lk)); convert_file_lock(&arg->lk, &lk); - req->f->op.setlk(req, nodeid, sleep, &lk); + req->f->op.setlk(req, nodeid, issleep, &lk); } else fuse_reply_err(req, ENOSYS); } @@ -781,7 +781,7 @@ void fuse_ll_process_cmd(struct fuse_ll *f, struct fuse_cmd *cmd) if (f->debug) { printf("unique: %llu, opcode: %s (%i), nodeid: %lu, insize: %i\n", - in->unique, opname(in->opcode), in->opcode, + in->unique, opname((enum fuse_opcode) in->opcode), in->opcode, (unsigned long) in->nodeid, cmd->buflen); fflush(stdout); } @@ -936,7 +936,7 @@ void fuse_ll_process_cmd(struct fuse_ll *f, struct fuse_cmd *cmd) case FUSE_SETLKW: do_setlk(req, in->nodeid, 1, (struct fuse_lk_in_out *) inarg); break; - + case FUSE_ACCESS: do_access(req, in->nodeid, (struct fuse_access_in *) inarg); break; diff --git a/lib/fuse_lowlevel_mt.c b/lib/fuse_lowlevel_mt.c index a06d42c..ee3a0ac 100644 --- a/lib/fuse_lowlevel_mt.c +++ b/lib/fuse_lowlevel_mt.c @@ -94,7 +94,7 @@ int fuse_ll_loop_mt_proc(struct fuse_ll *f, fuse_ll_processor_t proc, void *data struct fuse_worker *w; int i; - w = malloc(sizeof(struct fuse_worker)); + w = (struct fuse_worker *) malloc(sizeof(struct fuse_worker)); if (w == NULL) { fprintf(stderr, "fuse: failed to allocate worker structure\n"); return -1; diff --git a/lib/fuse_mt.c b/lib/fuse_mt.c index bbd0392..8359994 100644 --- a/lib/fuse_mt.c +++ b/lib/fuse_mt.c @@ -40,7 +40,7 @@ static void mt_freecontext(void *data) free(data); } -static int mt_create_context_key() +static int mt_create_context_key(void) { int err = 0; pthread_mutex_lock(&context_lock); @@ -58,7 +58,7 @@ static int mt_create_context_key() return err; } -static void mt_delete_context_key() +static void mt_delete_context_key(void) { pthread_mutex_lock(&context_lock); context_ref--; diff --git a/lib/helper.c b/lib/helper.c index 681197d..a6c472f 100644 --- a/lib/helper.c +++ b/lib/helper.c @@ -63,13 +63,14 @@ static void invalid_option(const char *argv[], int argctr) fprintf(stderr, "see `%s -h' for usage\n", argv[0]); } -static void exit_handler() +static void exit_handler(int sig) { + (void) sig; if (fuse_instance != NULL) fuse_exit(fuse_instance); } -static int set_one_signal_handler(int signal, void (*handler)(int)) +static int set_one_signal_handler(int sig, void (*handler)(int)) { struct sigaction sa; struct sigaction old_sa; @@ -79,20 +80,20 @@ static int set_one_signal_handler(int signal, void (*handler)(int)) sigemptyset(&(sa.sa_mask)); sa.sa_flags = 0; - if (sigaction(signal, NULL, &old_sa) == -1) { + if (sigaction(sig, NULL, &old_sa) == -1) { perror("FUSE: cannot get old signal handler"); return -1; } if (old_sa.sa_handler == SIG_DFL && - sigaction(signal, &sa, NULL) == -1) { + sigaction(sig, &sa, NULL) == -1) { perror("Cannot set signal handler"); return -1; } return 0; } -static int set_signal_handlers() +static int set_signal_handlers(void) { if (set_one_signal_handler(SIGHUP, exit_handler) == -1 || set_one_signal_handler(SIGINT, exit_handler) == -1 || @@ -121,13 +122,13 @@ static int add_option_to(const char *opt, char **optp) unsigned len = strlen(opt); if (*optp) { unsigned oldlen = strlen(*optp); - *optp = realloc(*optp, oldlen + 1 + len + 1); + *optp = (char *) realloc(*optp, oldlen + 1 + len + 1); if (*optp == NULL) return -1; (*optp)[oldlen] = ','; strcpy(*optp + oldlen + 1, opt); } else { - *optp = malloc(len + 1); + *optp = (char *) malloc(len + 1); if (*optp == NULL) return -1; strcpy(*optp, opt); @@ -197,7 +198,7 @@ static int fuse_parse_cmdline(int argc, const char *argv[], char **kernel_opts, else if (basename[1] != '\0') basename++; - fsname_opt = malloc(strlen(basename) + 64); + fsname_opt = (char *) malloc(strlen(basename) + 64); if (fsname_opt == NULL) { fprintf(stderr, "fuse: memory allocation failed\n"); return -1; @@ -419,7 +420,7 @@ int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op, } #undef fuse_main -int fuse_main() +int fuse_main(void) { fprintf(stderr, "fuse_main(): This function does not exist\n"); return -1; diff --git a/lib/mount.c b/lib/mount.c index 01081bb..3236ce8 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -108,7 +108,7 @@ int fuse_mount(const char *mountpoint, const char *opts) char env[10]; const char *argv[32]; int a = 0; - + argv[a++] = mountprog; if (opts) { argv[a++] = "-o"; diff --git a/util/fusermount.c b/util/fusermount.c index 9c7bbf3..21504d4 100644 --- a/util/fusermount.c +++ b/util/fusermount.c @@ -51,7 +51,7 @@ static const char *progname; static int user_allow_other = 0; static int mount_max = 1000; -static const char *get_user_name() +static const char *get_user_name(void) { struct passwd *pw = getpwuid(getuid()); if (pw != NULL && pw->pw_name != NULL) @@ -95,7 +95,7 @@ static int do_unmount(const char *mnt, int quiet, int lazy) #ifndef USE_UCLIBC /* use a lock file so that multiple fusermount processes don't try and modify the mtab file at once! */ -static int lock_mtab() +static int lock_mtab(void) { const char *mtab_lock = _PATH_MOUNTED ".fuselock"; int mtablock; @@ -184,18 +184,18 @@ static int remove_mount(const char *mnt, int quiet, const char *mtab, found = 0; while ((entp = getmntent(fp)) != NULL) { - int remove = 0; + int removed = 0; if (!found && strcmp(entp->mnt_dir, mnt) == 0 && strcmp(entp->mnt_type, "fuse") == 0) { if (user == NULL) - remove = 1; + removed = 1; else { char *p = strstr(entp->mnt_opts, "user="); if (p != NULL && strcmp(p + 5, user) == 0) - remove = 1; + removed = 1; } } - if (remove) + if (removed) found = 1; else { res = addmntent(newfp, entp); @@ -220,7 +220,7 @@ static int remove_mount(const char *mnt, int quiet, const char *mtab, return 0; } -static int count_fuse_fs() +static int count_fuse_fs(void) { struct mntent *entp; int count = 0; @@ -424,7 +424,7 @@ static int add_option(char **optsp, const char *opt, unsigned expand) else { unsigned oldsize = strlen(*optsp); unsigned newsize = oldsize + 1 + strlen(opt) + expand + 1; - newopts = realloc(*optsp, newsize); + newopts = (char *) realloc(*optsp, newsize); if (newopts) sprintf(newopts + oldsize, ",%s", opt); } @@ -521,7 +521,7 @@ static int do_mount(const char *mnt, const char *type, mode_t rootmode, char *fsname = NULL; int check_empty = 1; - optbuf = malloc(strlen(opts) + 128); + optbuf = (char *) malloc(strlen(opts) + 128); if (!optbuf) { fprintf(stderr, "%s: failed to allocate memory\n", progname); return -1; @@ -535,7 +535,7 @@ static int do_mount(const char *mnt, const char *type, mode_t rootmode, unsigned fsname_str_len = strlen(fsname_str); if (fsname) free(fsname); - fsname = malloc(len - fsname_str_len + 1); + fsname = (char *) malloc(len - fsname_str_len + 1); if (!fsname) { fprintf(stderr, "%s: failed to allocate memory\n", progname); goto err; -- 2.30.2