aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-03-19 08:59:02 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2016-03-19 08:59:02 +0200
commit238924457849e53eae3771bc6240883b37e1ff34 (patch)
treed3be17fde8c3f8e919b8d7e5ea72f34805926386 /src
parentc95307bfe28691d00f8ad394dec1966f0bf14e32 (diff)
downloadpies-238924457849e53eae3771bc6240883b37e1ff34.tar.gz
pies-238924457849e53eae3771bc6240883b37e1ff34.tar.bz2
Fix some compilation issues on Solaris
* configure.ac: Check for libnsl * src/pies.c (string_to_syslog_facility): LOG_AUTHPRIV and LOG_FTP may be undefined. * src/piesctl.c (EX_NOTFOUND): Rename to EX_PIES_NOTFOUND. (com_list): Use default_cond. * src/sysvinit.c (console_stty): Make sure CBAUDEX is defined. * src/utmp.c (fill_utmp): Declare locals right before using them.
Diffstat (limited to 'src')
-rw-r--r--src/pies.c4
-rw-r--r--src/piesctl.c34
-rw-r--r--src/sysvinit.c4
-rw-r--r--src/utmp.c23
4 files changed, 36 insertions, 29 deletions
diff --git a/src/pies.c b/src/pies.c
index 695c1b0..3fb181c 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -633,16 +633,20 @@ string_to_syslog_priority (const char *key, int *pres)
int
string_to_syslog_facility (const char *key, int *pres)
{
static struct tokendef tokdef_fac[] = {
{"auth", LOG_AUTH},
+#ifdef LOG_AUTHPRIV
{"authpriv", LOG_AUTHPRIV},
+#endif
{"cron", LOG_CRON},
{"daemon", LOG_DAEMON},
+#ifdef LOG_FTP
{"ftp", LOG_FTP},
+#endif
{"kern", LOG_KERN},
{"lpr", LOG_LPR},
{"mail", LOG_MAIL},
{"news", LOG_NEWS},
{"syslog", LOG_SYSLOG},
{"user", LOG_USER},
diff --git a/src/piesctl.c b/src/piesctl.c
index d10bd0e..71efbcd 100644
--- a/src/piesctl.c
+++ b/src/piesctl.c
@@ -51,14 +51,14 @@ char default_config_file[] = SYSCONFDIR "/piesctl.conf";
int preprocess_only;
int verbose;
int dump;
struct grecs_sockaddr_hints hints = { .flags = GRECS_AH_PASSIVE };
-#define EX_OK 0
-#define EX_NOTFOUND 1
+#define EX_OK 0
+#define EX_PIES_NOTFOUND 1
int exit_status = EX_OK;
static void config_help (void);
#include "piesctl-cl.h"
@@ -1003,13 +1003,13 @@ shttp_process (struct shttp_connection *conn, int method, char const *uri)
else
shttp_fatal (conn);
break;
case 404: /* Not found */
case 409: /* Conflict */
- exit_status = EX_NOTFOUND;
+ exit_status = EX_PIES_NOTFOUND;
shttp_print_error (conn);
return;
default:
shttp_fatal (conn);
}
@@ -1481,17 +1481,30 @@ parse_condition_to_uri (char const *base, struct cmdline_parser_state *state,
val = parse_condition (state);
ret = piesctl_format (val, base);
json_value_free (val);
return ret;
}
+/* Provide default condition if there are no more arguments */
+static struct cmdline_parser_state *
+default_cond (struct cmdline_parser_state *state)
+{
+ if (!peek_token (state))
+ {
+ static char *dfl[] = { "type", "component", NULL };
+ state->argc = sizeof (dfl) / sizeof (dfl[0]);
+ state->argv = dfl;
+ }
+ return state;
+}
+
static void
com_list (struct cmdline_parser_state *state)
{
struct shttp_connection *conn = state->conn;
- char *uri = parse_condition_to_uri ("/programs", state, 0);
+ char *uri = parse_condition_to_uri ("/programs", default_cond (state), 0);
shttp_io_init (&conn->req);
shttp_process (conn, METH_GET, uri);
grecs_free (uri);
if (conn->resp.code == 200 && !dump
&& conn->result && conn->result->type == json_arr)
@@ -1580,25 +1593,12 @@ shttp_print_response_status (struct shttp_connection *conn)
}
}
}
}
}
-/* Provide default condition if there are no more arguments */
-static struct cmdline_parser_state *
-default_cond (struct cmdline_parser_state *state)
-{
- if (!peek_token (state))
- {
- static char *dfl[] = { "type", "component", NULL };
- state->argc = sizeof (dfl) / sizeof (dfl[0]);
- state->argv = dfl;
- }
- return state;
-}
-
static void
com_stop (struct cmdline_parser_state *state)
{
struct shttp_connection *conn = state->conn;
char *uri = parse_condition_to_uri ("/programs", default_cond (state), 1);
diff --git a/src/sysvinit.c b/src/sysvinit.c
index 9043619..3078834 100644
--- a/src/sysvinit.c
+++ b/src/sysvinit.c
@@ -79,12 +79,16 @@ console_open (int mode)
return fd;
}
}
return -1;
}
+#ifndef CBAUDEX
+# define CBAUDEX 0
+#endif
+
void
console_stty (void)
{
struct termios tty;
int fd;
diff --git a/src/utmp.c b/src/utmp.c
index b2a232f..e13b74d 100644
--- a/src/utmp.c
+++ b/src/utmp.c
@@ -76,35 +76,34 @@ pies_getutxid (const UTMPX *ut)
void
fill_utmp (UTMPX *utmp,
int type, const char *user, const char *id, pid_t pid,
const char *line)
{
-#if defined HAVE_STRUCT_UTMP_UT_HOST
- struct utsname uts;
-#endif
-#if defined HAVE_STRUCT_UTMP_UT_TV
- struct timeval tv;
-#endif
-
memset (utmp, 0, sizeof (*utmp));
#if defined(HAVE_STRUCT_UTMP_UT_TV) || defined(HAVE_STRUCT_UTMPX_UT_TV)
- gettimeofday (&tv, 0);
- utmp->ut_tv.tv_sec = tv.tv_sec;
- utmp->ut_tv.tv_usec = tv.tv_usec;
+ {
+ struct timeval tv;
+ gettimeofday (&tv, 0);
+ utmp->ut_tv.tv_sec = tv.tv_sec;
+ utmp->ut_tv.tv_usec = tv.tv_usec;
+ }
#elif defined(HAVE_STRUCT_UTMP_UT_TIME) || defined(HAVE_STRUCT_UTMPX_UT_TIME)
time (&utmp->ut_time);
#endif
utmp->ut_type = type;
strncpy (UT_NAME (utmp), user, sizeof (UT_NAME (utmp)));
strncpy (utmp->ut_id, id, sizeof (utmp->ut_id));
utmp->ut_pid = pid;
strncpy (utmp->ut_line, line, sizeof(utmp->ut_line));
#if defined(HAVE_STRUCT_UTMP_UT_HOST) || defined(HAVE_STRUCT_UTMPX_UT_HOST)
- if (uname (&uts) == 0)
- strncpy (utmp->ut_host, uts.release, sizeof(utmp->ut_host));
+ {
+ struct utsname uts;
+ if (uname (&uts) == 0)
+ strncpy (utmp->ut_host, uts.release, sizeof(utmp->ut_host));
+ }
#endif
}
void
write_wtmpx (int type, const char *user, const char *id, pid_t pid,
const char *line)

Return to:

Send suggestions and report system problems to the System administrator.