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
@@ -636,10 +636,14 @@ string_to_syslog_facility (const char *key, int *pres)
636{ 636{
637 static struct tokendef tokdef_fac[] = { 637 static struct tokendef tokdef_fac[] = {
638 {"auth", LOG_AUTH}, 638 {"auth", LOG_AUTH},
639#ifdef LOG_AUTHPRIV
639 {"authpriv", LOG_AUTHPRIV}, 640 {"authpriv", LOG_AUTHPRIV},
641#endif
640 {"cron", LOG_CRON}, 642 {"cron", LOG_CRON},
641 {"daemon", LOG_DAEMON}, 643 {"daemon", LOG_DAEMON},
644#ifdef LOG_FTP
642 {"ftp", LOG_FTP}, 645 {"ftp", LOG_FTP},
646#endif
643 {"kern", LOG_KERN}, 647 {"kern", LOG_KERN},
644 {"lpr", LOG_LPR}, 648 {"lpr", LOG_LPR},
645 {"mail", LOG_MAIL}, 649 {"mail", LOG_MAIL},
diff --git a/src/piesctl.c b/src/piesctl.c
index d10bd0e..71efbcd 100644
--- a/src/piesctl.c
+++ b/src/piesctl.c
@@ -54,8 +54,8 @@ int dump;
54 54
55struct grecs_sockaddr_hints hints = { .flags = GRECS_AH_PASSIVE }; 55struct grecs_sockaddr_hints hints = { .flags = GRECS_AH_PASSIVE };
56 56
57#define EX_OK 0 57#define EX_OK 0
58#define EX_NOTFOUND 1 58#define EX_PIES_NOTFOUND 1
59 59
60int exit_status = EX_OK; 60int exit_status = EX_OK;
61 61
@@ -1006,7 +1006,7 @@ shttp_process (struct shttp_connection *conn, int method, char const *uri)
1006 1006
1007 case 404: /* Not found */ 1007 case 404: /* Not found */
1008 case 409: /* Conflict */ 1008 case 409: /* Conflict */
1009 exit_status = EX_NOTFOUND; 1009 exit_status = EX_PIES_NOTFOUND;
1010 shttp_print_error (conn); 1010 shttp_print_error (conn);
1011 return; 1011 return;
1012 1012
@@ -1484,11 +1484,24 @@ parse_condition_to_uri (char const *base, struct cmdline_parser_state *state,
1484 return ret; 1484 return ret;
1485} 1485}
1486 1486
1487/* Provide default condition if there are no more arguments */
1488static struct cmdline_parser_state *
1489default_cond (struct cmdline_parser_state *state)
1490{
1491 if (!peek_token (state))
1492 {
1493 static char *dfl[] = { "type", "component", NULL };
1494 state->argc = sizeof (dfl) / sizeof (dfl[0]);
1495 state->argv = dfl;
1496 }
1497 return state;
1498}
1499
1487static void 1500static void
1488com_list (struct cmdline_parser_state *state) 1501com_list (struct cmdline_parser_state *state)
1489{ 1502{
1490 struct shttp_connection *conn = state->conn; 1503 struct shttp_connection *conn = state->conn;
1491 char *uri = parse_condition_to_uri ("/programs", state, 0); 1504 char *uri = parse_condition_to_uri ("/programs", default_cond (state), 0);
1492 1505
1493 shttp_io_init (&conn->req); 1506 shttp_io_init (&conn->req);
1494 shttp_process (conn, METH_GET, uri); 1507 shttp_process (conn, METH_GET, uri);
@@ -1583,19 +1596,6 @@ shttp_print_response_status (struct shttp_connection *conn)
1583 } 1596 }
1584} 1597}
1585 1598
1586/* Provide default condition if there are no more arguments */
1587static struct cmdline_parser_state *
1588default_cond (struct cmdline_parser_state *state)
1589{
1590 if (!peek_token (state))
1591 {
1592 static char *dfl[] = { "type", "component", NULL };
1593 state->argc = sizeof (dfl) / sizeof (dfl[0]);
1594 state->argv = dfl;
1595 }
1596 return state;
1597}
1598
1599static void 1599static void
1600com_stop (struct cmdline_parser_state *state) 1600com_stop (struct cmdline_parser_state *state)
1601{ 1601{
diff --git a/src/sysvinit.c b/src/sysvinit.c
index 9043619..3078834 100644
--- a/src/sysvinit.c
+++ b/src/sysvinit.c
@@ -82,6 +82,10 @@ console_open (int mode)
82 return -1; 82 return -1;
83} 83}
84 84
85#ifndef CBAUDEX
86# define CBAUDEX 0
87#endif
88
85void 89void
86console_stty (void) 90console_stty (void)
87{ 91{
diff --git a/src/utmp.c b/src/utmp.c
index b2a232f..e13b74d 100644
--- a/src/utmp.c
+++ b/src/utmp.c
@@ -79,18 +79,14 @@ fill_utmp (UTMPX *utmp,
79 int type, const char *user, const char *id, pid_t pid, 79 int type, const char *user, const char *id, pid_t pid,
80 const char *line) 80 const char *line)
81{ 81{
82#if defined HAVE_STRUCT_UTMP_UT_HOST
83 struct utsname uts;
84#endif
85#if defined HAVE_STRUCT_UTMP_UT_TV
86 struct timeval tv;
87#endif
88
89 memset (utmp, 0, sizeof (*utmp)); 82 memset (utmp, 0, sizeof (*utmp));
90#if defined(HAVE_STRUCT_UTMP_UT_TV) || defined(HAVE_STRUCT_UTMPX_UT_TV) 83#if defined(HAVE_STRUCT_UTMP_UT_TV) || defined(HAVE_STRUCT_UTMPX_UT_TV)
91 gettimeofday (&tv, 0); 84 {
92 utmp->ut_tv.tv_sec = tv.tv_sec; 85 struct timeval tv;
93 utmp->ut_tv.tv_usec = tv.tv_usec; 86 gettimeofday (&tv, 0);
87 utmp->ut_tv.tv_sec = tv.tv_sec;
88 utmp->ut_tv.tv_usec = tv.tv_usec;
89 }
94#elif defined(HAVE_STRUCT_UTMP_UT_TIME) || defined(HAVE_STRUCT_UTMPX_UT_TIME) 90#elif defined(HAVE_STRUCT_UTMP_UT_TIME) || defined(HAVE_STRUCT_UTMPX_UT_TIME)
95 time (&utmp->ut_time); 91 time (&utmp->ut_time);
96#endif 92#endif
@@ -100,8 +96,11 @@ fill_utmp (UTMPX *utmp,
100 utmp->ut_pid = pid; 96 utmp->ut_pid = pid;
101 strncpy (utmp->ut_line, line, sizeof(utmp->ut_line)); 97 strncpy (utmp->ut_line, line, sizeof(utmp->ut_line));
102#if defined(HAVE_STRUCT_UTMP_UT_HOST) || defined(HAVE_STRUCT_UTMPX_UT_HOST) 98#if defined(HAVE_STRUCT_UTMP_UT_HOST) || defined(HAVE_STRUCT_UTMPX_UT_HOST)
103 if (uname (&uts) == 0) 99 {
104 strncpy (utmp->ut_host, uts.release, sizeof(utmp->ut_host)); 100 struct utsname uts;
101 if (uname (&uts) == 0)
102 strncpy (utmp->ut_host, uts.release, sizeof(utmp->ut_host));
103 }
105#endif 104#endif
106} 105}
107 106

Return to:

Send suggestions and report system problems to the System administrator.