From: Kern Sibbald Date: Sun, 28 May 2017 16:47:27 +0000 (+0200) Subject: Fix some problems noted by clang X-Git-Tag: Release-7.9.1~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=30386c2536d58966c09e91588fbd803483ecfd10;p=bacula%2Fbacula Fix some problems noted by clang --- diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 51fe898e41..29257625a7 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -246,7 +246,7 @@ int restore_cmd(UAContext *ua, const char *cmd) } get_client_name(ua, &rx); - if (!rx.ClientName) { + if (!rx.ClientName[0]) { ua->error_msg(_("No Client resource found!\n")); goto bail_out; } diff --git a/bacula/src/dird/ua_run.c b/bacula/src/dird/ua_run.c index c22b9f4e9c..4d79e5ef7d 100644 --- a/bacula/src/dird/ua_run.c +++ b/bacula/src/dird/ua_run.c @@ -2100,7 +2100,7 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char break; case JT_COPY: case JT_MIGRATE: - char *prt_type; + const char *prt_type; jcr->setJobLevel(L_FULL); /* default level */ if (ua->api) { ua->signal(BNET_RUN_CMD); diff --git a/bacula/src/dird/ua_update.c b/bacula/src/dird/ua_update.c index bc8fabb98f..9a70c13e0a 100644 --- a/bacula/src/dird/ua_update.c +++ b/bacula/src/dird/ua_update.c @@ -365,7 +365,8 @@ void update_vol_recyclepool(UAContext *ua, char *val, MEDIA_DBR *mr) { POOL_DBR pr; POOL_MEM query(PM_MESSAGE); - char ed1[50], ed2[50], *poolname; + char ed1[50], ed2[50]; + const char *poolname; if(val && *val) { /* update volume recyclepool="Scratch" */ /* If a pool name is given, look up the PoolId */ diff --git a/bacula/src/filed/status.c b/bacula/src/filed/status.c index 2a9deaa112..c8b38ef3f9 100644 --- a/bacula/src/filed/status.c +++ b/bacula/src/filed/status.c @@ -52,13 +52,6 @@ void output_status(STATUS_PKT *sp) list_terminated_jobs(sp); /* defined in lib/status.h */ } -#if defined(HAVE_LZO) -static const bool have_lzo = true; -#else -static const bool have_lzo = false; -#endif - - static void api_list_status_header(STATUS_PKT *sp) { char *p; diff --git a/bacula/src/findlib/fstype.c b/bacula/src/findlib/fstype.c index a801d9afaa..a61886c59f 100644 --- a/bacula/src/findlib/fstype.c +++ b/bacula/src/findlib/fstype.c @@ -67,6 +67,7 @@ static int compare_mtab_items(void *item1, void *item2) return 0; } +#if defined(HAVE_LINUX_OS) static void add_mtab_item(void *user_ctx, struct stat *st, const char *fstype, const char *mountpoint, const char *mntopts, const char *fsname) @@ -84,6 +85,7 @@ static void add_mtab_item(void *user_ctx, struct stat *st, const char *fstype, free(item); } } +#endif /* Compare directly the FS from a fname with a string */ bool fstype_cmp(FF_PKT *ff_pkt, const char *fsname) diff --git a/bacula/src/lib/bpipe.c b/bacula/src/lib/bpipe.c index 4c90c874a6..b28068522f 100644 --- a/bacula/src/lib/bpipe.c +++ b/bacula/src/lib/bpipe.c @@ -73,8 +73,10 @@ BPIPE *open_bpipe(char *prog, int wait, const char *mode, char *envp[]) int mode_read, mode_write, mode_shell; BPIPE *bpipe; int save_errno; +#if !defined(HAVE_FCNTL_F_CLOSEM) && !defined(HAVE_CLOSEFROM) struct rlimit rl; int64_t rlimitResult=0; +#endif if (!prog || !*prog) { /* execve(3) A component of the file does not name an existing file or file is an empty string. */