Quiet some lint warnings.
This commit is contained in:
parent
e5baa6ad37
commit
b4bff9ce5e
@ -65,8 +65,11 @@
|
|||||||
|
|
||||||
#define RC_PLUGINDIR RC_LIBDIR "/plugins"
|
#define RC_PLUGINDIR RC_LIBDIR "/plugins"
|
||||||
|
|
||||||
#define ERRX fprintf (stderr, "out of memory\n"); exit (1)
|
#define ERRX fprintf (stderr, "out of memory\n"); exit (1)
|
||||||
|
|
||||||
|
#ifdef lint
|
||||||
|
# define _unused
|
||||||
|
#endif
|
||||||
#if __GNUC__ > 2 || defined(__INTEL_COMPILER)
|
#if __GNUC__ > 2 || defined(__INTEL_COMPILER)
|
||||||
# define _unused __attribute__((__unused__))
|
# define _unused __attribute__((__unused__))
|
||||||
#endif
|
#endif
|
||||||
@ -79,6 +82,7 @@ _unused static void *xmalloc (size_t size)
|
|||||||
return (value);
|
return (value);
|
||||||
|
|
||||||
ERRX;
|
ERRX;
|
||||||
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
_unused static void *xrealloc (void *ptr, size_t size)
|
_unused static void *xrealloc (void *ptr, size_t size)
|
||||||
@ -89,6 +93,7 @@ _unused static void *xrealloc (void *ptr, size_t size)
|
|||||||
return (value);
|
return (value);
|
||||||
|
|
||||||
ERRX;
|
ERRX;
|
||||||
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
_unused static char *xstrdup (const char *str)
|
_unused static char *xstrdup (const char *str)
|
||||||
@ -104,6 +109,7 @@ _unused static char *xstrdup (const char *str)
|
|||||||
return (value);
|
return (value);
|
||||||
|
|
||||||
ERRX;
|
ERRX;
|
||||||
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef ERRX
|
#undef ERRX
|
||||||
|
@ -309,7 +309,7 @@ bool rc_service_daemon_set (const char *service, const char *exec,
|
|||||||
{
|
{
|
||||||
char *dirpath;
|
char *dirpath;
|
||||||
char *file = NULL;
|
char *file = NULL;
|
||||||
int i;
|
size_t l;
|
||||||
char *mexec;
|
char *mexec;
|
||||||
char *mname;
|
char *mname;
|
||||||
char *mpidfile;
|
char *mpidfile;
|
||||||
@ -328,23 +328,23 @@ bool rc_service_daemon_set (const char *service, const char *exec,
|
|||||||
basename_c (service), (char *) NULL);
|
basename_c (service), (char *) NULL);
|
||||||
|
|
||||||
if (exec) {
|
if (exec) {
|
||||||
i = strlen (exec) + 6;
|
l = strlen (exec) + 6;
|
||||||
mexec = xmalloc (sizeof (char) * i);
|
mexec = xmalloc (sizeof (char) * l);
|
||||||
snprintf (mexec, i, "exec=%s", exec);
|
snprintf (mexec, l, "exec=%s", exec);
|
||||||
} else
|
} else
|
||||||
mexec = xstrdup ("exec=");
|
mexec = xstrdup ("exec=");
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
i = strlen (name) + 6;
|
l = strlen (name) + 6;
|
||||||
mname = xmalloc (sizeof (char) * i);
|
mname = xmalloc (sizeof (char) * l);
|
||||||
snprintf (mname, i, "name=%s", name);
|
snprintf (mname, l, "name=%s", name);
|
||||||
} else
|
} else
|
||||||
mname = xstrdup ("name=");
|
mname = xstrdup ("name=");
|
||||||
|
|
||||||
if (pidfile) {
|
if (pidfile) {
|
||||||
i = strlen (pidfile) + 9;
|
l = strlen (pidfile) + 9;
|
||||||
mpidfile = xmalloc (sizeof (char) * i);
|
mpidfile = xmalloc (sizeof (char) * l);
|
||||||
snprintf (mpidfile, i, "pidfile=%s", pidfile);
|
snprintf (mpidfile, l, "pidfile=%s", pidfile);
|
||||||
} else
|
} else
|
||||||
mpidfile = xstrdup ("pidfile=");
|
mpidfile = xstrdup ("pidfile=");
|
||||||
|
|
||||||
@ -406,7 +406,7 @@ bool rc_service_started_daemon (const char *service, const char *exec,
|
|||||||
{
|
{
|
||||||
char *dirpath;
|
char *dirpath;
|
||||||
char *file;
|
char *file;
|
||||||
int i;
|
size_t l;
|
||||||
char *mexec;
|
char *mexec;
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
@ -418,14 +418,14 @@ bool rc_service_started_daemon (const char *service, const char *exec,
|
|||||||
dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename_c (service),
|
dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename_c (service),
|
||||||
(char *) NULL);
|
(char *) NULL);
|
||||||
|
|
||||||
i = strlen (exec) + 6;
|
l = strlen (exec) + 6;
|
||||||
mexec = xmalloc (sizeof (char) * i);
|
mexec = xmalloc (sizeof (char) * l);
|
||||||
snprintf (mexec, i, "exec=%s", exec);
|
snprintf (mexec, l, "exec=%s", exec);
|
||||||
|
|
||||||
if (indx > 0) {
|
if (indx > 0) {
|
||||||
int len = sizeof (char) * 10;
|
l = sizeof (char) * 10;
|
||||||
file = xmalloc (len);
|
file = xmalloc (l);
|
||||||
snprintf (file, len, "%03d", indx);
|
snprintf (file, l, "%03d", indx);
|
||||||
retval = _match_daemon (dirpath, file, mexec, NULL, NULL);
|
retval = _match_daemon (dirpath, file, mexec, NULL, NULL);
|
||||||
free (file);
|
free (file);
|
||||||
} else {
|
} else {
|
||||||
|
@ -57,8 +57,8 @@ librc_hidden_def(rc_yesno)
|
|||||||
char *rc_strcatpaths (const char *path1, const char *paths, ...)
|
char *rc_strcatpaths (const char *path1, const char *paths, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int length;
|
size_t length;
|
||||||
int i;
|
size_t i;
|
||||||
char *p;
|
char *p;
|
||||||
char *path;
|
char *path;
|
||||||
char *pathp;
|
char *pathp;
|
||||||
@ -176,7 +176,7 @@ char **rc_config_load (const char *file)
|
|||||||
char *line;
|
char *line;
|
||||||
char *linep;
|
char *linep;
|
||||||
char *linetok;
|
char *linetok;
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
int j;
|
int j;
|
||||||
bool replaced;
|
bool replaced;
|
||||||
char *entry;
|
char *entry;
|
||||||
@ -251,7 +251,7 @@ char *rc_config_value (const char *const *list, const char *entry)
|
|||||||
|
|
||||||
STRLIST_FOREACH (list, line, i) {
|
STRLIST_FOREACH (list, line, i) {
|
||||||
p = strchr (line, '=');
|
p = strchr (line, '=');
|
||||||
if (p && strncmp (entry, line, p - line) == 0)
|
if (p && strncmp (entry, line, (size_t) (p - line)) == 0)
|
||||||
return (p += 1);
|
return (p += 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ char **rc_service_extra_commands (const char *service)
|
|||||||
char *token;
|
char *token;
|
||||||
char *p;
|
char *p;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int l;
|
size_t l;
|
||||||
|
|
||||||
if (! (svc = rc_service_resolve (service)))
|
if (! (svc = rc_service_resolve (service)))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@ -337,7 +337,7 @@ char *rc_service_description (const char *service, const char *option)
|
|||||||
char *cmd;
|
char *cmd;
|
||||||
char *desc = NULL;
|
char *desc = NULL;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int i;
|
size_t l;
|
||||||
|
|
||||||
if (! (svc = rc_service_resolve (service)))
|
if (! (svc = rc_service_resolve (service)))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@ -345,9 +345,9 @@ char *rc_service_description (const char *service, const char *option)
|
|||||||
if (! option)
|
if (! option)
|
||||||
option = "";
|
option = "";
|
||||||
|
|
||||||
i = strlen (DESCSTR) + strlen (svc) + strlen (option) + 2;
|
l = strlen (DESCSTR) + strlen (svc) + strlen (option) + 2;
|
||||||
cmd = xmalloc (sizeof (char) * i);
|
cmd = xmalloc (sizeof (char) * l);
|
||||||
snprintf (cmd, i, DESCSTR, svc, option ? "_" : "", option);
|
snprintf (cmd, l, DESCSTR, svc, option ? "_" : "", option);
|
||||||
free (svc);
|
free (svc);
|
||||||
if ((fp = popen (cmd, "r"))) {
|
if ((fp = popen (cmd, "r"))) {
|
||||||
desc = rc_getline (fp);
|
desc = rc_getline (fp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user