Merge "fs_mgr: fix clang static analyzer warning"
This commit is contained in:
commit
d945f27cd6
|
@ -407,7 +407,7 @@ static int __mount(const char *source, const char *target, const struct fstab_re
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int fs_match(char *in1, char *in2)
|
||||
static int fs_match(const char *in1, const char *in2)
|
||||
{
|
||||
char *n1;
|
||||
char *n2;
|
||||
|
@ -837,7 +837,7 @@ int fs_mgr_mount_all(struct fstab *fstab, int mount_mode)
|
|||
* If multiple fstab entries are to be mounted on "n_name", it will try to mount each one
|
||||
* in turn, and stop on 1st success, or no more match.
|
||||
*/
|
||||
int fs_mgr_do_mount(struct fstab *fstab, char *n_name, char *n_blk_device,
|
||||
int fs_mgr_do_mount(struct fstab *fstab, const char *n_name, char *n_blk_device,
|
||||
char *tmp_mount_point)
|
||||
{
|
||||
int i = 0;
|
||||
|
|
|
@ -14,12 +14,17 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <libgen.h>
|
||||
#include "fs_mgr_priv.h"
|
||||
|
||||
#ifdef _LIBGEN_H
|
||||
#warning "libgen.h must not be included"
|
||||
#endif
|
||||
|
||||
char *me = "";
|
||||
|
||||
static void usage(void)
|
||||
|
@ -32,10 +37,10 @@ static void usage(void)
|
|||
* and exit the program, do not return to the caller.
|
||||
* Return the number of argv[] entries consumed.
|
||||
*/
|
||||
static void parse_options(int argc, char *argv[], int *a_flag, int *u_flag, int *n_flag,
|
||||
char **n_name, char **n_blk_dev)
|
||||
static void parse_options(int argc, char * const argv[], int *a_flag, int *u_flag, int *n_flag,
|
||||
const char **n_name, const char **n_blk_dev)
|
||||
{
|
||||
me = basename(strdup(argv[0]));
|
||||
me = basename(argv[0]);
|
||||
|
||||
if (argc <= 1) {
|
||||
usage();
|
||||
|
@ -75,14 +80,14 @@ static void parse_options(int argc, char *argv[], int *a_flag, int *u_flag, int
|
|||
return;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int main(int argc, char * const argv[])
|
||||
{
|
||||
int a_flag=0;
|
||||
int u_flag=0;
|
||||
int n_flag=0;
|
||||
char *n_name=NULL;
|
||||
char *n_blk_dev=NULL;
|
||||
char *fstab_file=NULL;
|
||||
const char *n_name=NULL;
|
||||
const char *n_blk_dev=NULL;
|
||||
const char *fstab_file=NULL;
|
||||
struct fstab *fstab=NULL;
|
||||
|
||||
klog_set_level(6);
|
||||
|
@ -97,7 +102,7 @@ int main(int argc, char *argv[])
|
|||
if (a_flag) {
|
||||
return fs_mgr_mount_all(fstab, MOUNT_MODE_DEFAULT);
|
||||
} else if (n_flag) {
|
||||
return fs_mgr_do_mount(fstab, n_name, n_blk_dev, 0);
|
||||
return fs_mgr_do_mount(fstab, n_name, (char *)n_blk_dev, 0);
|
||||
} else if (u_flag) {
|
||||
return fs_mgr_unmount_all(fstab);
|
||||
} else {
|
||||
|
|
|
@ -99,7 +99,7 @@ int fs_mgr_mount_all(struct fstab *fstab, int mount_mode);
|
|||
#define FS_MGR_DOMNT_FAILED (-1)
|
||||
#define FS_MGR_DOMNT_BUSY (-2)
|
||||
|
||||
int fs_mgr_do_mount(struct fstab *fstab, char *n_name, char *n_blk_device,
|
||||
int fs_mgr_do_mount(struct fstab *fstab, const char *n_name, char *n_blk_device,
|
||||
char *tmp_mount_point);
|
||||
int fs_mgr_do_tmpfs_mount(char *n_name);
|
||||
int fs_mgr_unmount_all(struct fstab *fstab);
|
||||
|
|
Loading…
Reference in New Issue