From f4f515d212d57f4881d709a5bd6bfd9b9351e1d0 Mon Sep 17 00:00:00 2001 From: Gourd Date: Fri, 4 Dec 2026 22:16:32 -0500 Subject: [PATCH] Fix building on Chimera Linux (and other similar operating systems) zoitechat references kill, popen, pclose, gmtime_r, and localtime_r which are POSIX-only functions that need #define _POSIX_SOURCE to build with LLVM or musl C, one of the two. --- plugins/sysinfo/shared/df.c | 3 ++- src/common/proto-irc.c | 45 +++++++++++++++++++------------------ src/common/server.c | 6 ++++- src/common/zoitechat.c | 12 ++++++---- 4 files changed, 38 insertions(+), 28 deletions(-) diff --git a/plugins/sysinfo/shared/df.c b/plugins/sysinfo/shared/df.c index bb2c2131..e9c6e47f 100644 --- a/plugins/sysinfo/shared/df.c +++ b/plugins/sysinfo/shared/df.c @@ -14,6 +14,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#define _POSIX_C_SOURCE 200809L #include #include #include @@ -25,7 +26,7 @@ int xs_parse_df(gint64 *out_total, gint64 *out_free) { FILE *pipe; char buffer[bsize]; - + pipe = popen("df -k -l -P --exclude-type=squashfs --exclude-type=devtmpfs --exclude-type=tmpfs", "r"); if(pipe==NULL) return 1; diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 5f1cf62c..e893d85b 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -18,6 +18,7 @@ /* IRC RFC1459(+commonly used extensions) protocol implementation */ +#define _POSIX_C_SOURCE 200809L #include #include #include @@ -492,7 +493,7 @@ process_numeric (session * sess, int n, server *serv = sess->server; /* show whois is the server tab */ session *whois_sess = serv->server_session; - + /* unless this setting is on */ if (prefs.hex_irc_whois_front) whois_sess = serv->front_session; @@ -663,7 +664,7 @@ process_numeric (session * sess, int n, case 323: if (!fe_is_chanwindow (sess->server)) - EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVTEXT, serv->server_session, text, + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVTEXT, serv->server_session, text, word[1], word[2], NULL, 0, tags_data->timestamp); else fe_chan_list_end (sess->server); @@ -693,7 +694,7 @@ process_numeric (session * sess, int n, if (sess) { EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANURL, sess, word[4], (word_eol[5][0] == ':') ? word_eol[5] + 1 : word_eol[5], - NULL, NULL, 0, tags_data->timestamp); + NULL, NULL, 0, tags_data->timestamp); } break; @@ -729,7 +730,7 @@ process_numeric (session * sess, int n, #if 0 case 338: /* Undernet Real user@host, Real IP */ - EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS_REALHOST, sess, word[4], word[5], word[6], + EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS_REALHOST, sess, word[4], word[5], word[6], (word_eol[7][0]==':') ? word_eol[7]+1 : word_eol[7], 0, tags_data->timestamp); break; @@ -962,7 +963,7 @@ process_numeric (session * sess, int n, break; case 900: /* successful SASL 'logged in as ' */ - EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVTEXT, serv->server_session, + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVTEXT, serv->server_session, word_eol[6]+1, word[1], word[2], NULL, 0, tags_data->timestamp); break; @@ -1001,7 +1002,7 @@ process_numeric (session * sess, int n, def: { session *sess; - + if (is_channel (serv, word[4])) { sess = find_channel (serv, word[4]); @@ -1012,7 +1013,7 @@ process_numeric (session * sess, int n, ; else sess=serv->server_session; - + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVTEXT, sess, text, word[1], word[2], NULL, 0, tags_data->timestamp); } @@ -1091,7 +1092,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], { guint32 t; - t = WORDL((guint8)type[0], (guint8)type[1], (guint8)type[2], (guint8)type[3]); + t = WORDL((guint8)type[0], (guint8)type[1], (guint8)type[2], (guint8)type[3]); /* this should compile to a bunch of: CMP.L, JE ... nice & fast */ switch (t) { @@ -1147,7 +1148,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], return; case WORDL('N','I','C','K'): - inbound_newnick (serv, nick, + inbound_newnick (serv, nick, (word_eol[3][0] == ':') ? word_eol[3] + 1 : word_eol[3], FALSE, tags_data); return; @@ -1231,7 +1232,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], { guint32 t; - t = WORDL((guint8)type[0], (guint8)type[1], (guint8)type[2], (guint8)type[3]); + t = WORDL((guint8)type[0], (guint8)type[1], (guint8)type[2], (guint8)type[3]); /* this should compile to a bunch of: CMP.L, JE ... nice & fast */ switch (t) { @@ -1267,7 +1268,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], EMIT_SIGNAL_TIMESTAMP (XP_TE_INVITED, sess, text, nick, serv->servername, NULL, 0, tags_data->timestamp); - + return; case WORDL('N','O','T','I'): @@ -1320,7 +1321,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], if (strchr (serv->chantypes, to[0]) == NULL && strchr (serv->nick_prefixes, to[0]) != NULL) to++; - + text = word_eol[4]; if (*text == ':') text++; @@ -1442,13 +1443,13 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], case WORDL('C','A','P','\0'): if (g_ascii_strncasecmp(word[4], "ACK", 3) == 0) { - inbound_cap_ack (serv, word[1], + inbound_cap_ack (serv, word[1], word[5][0] == ':' ? word_eol[5] + 1 : word_eol[5], tags_data); } else if (g_ascii_strncasecmp(word[4], "LS", 2) == 0) { - inbound_cap_ls (serv, word[1], + inbound_cap_ls (serv, word[1], word[5][0] == ':' ? word_eol[5] + 1 : word_eol[5], tags_data); } @@ -1462,9 +1463,9 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], { inbound_cap_nak (serv, word[5][0] == ':' ? word_eol[5] + 1 : word_eol[5], tags_data); } - else if (g_ascii_strncasecmp(word[4], "LIST", 4) == 0) + else if (g_ascii_strncasecmp(word[4], "LIST", 4) == 0) { - inbound_cap_list (serv, word[1], + inbound_cap_list (serv, word[1], word[5][0] == ':' ? word_eol[5] + 1 : word_eol[5], tags_data); } @@ -1508,7 +1509,7 @@ process_named_servermsg (session *sess, char *buf, char *rawname, char *word_eol buf = word_eol[3]; if (*buf == ':') buf++; - EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVNOTICE, sess, buf, + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVNOTICE, sess, buf, sess->server->servername, NULL, NULL, 0, tags_data->timestamp); return; @@ -1557,8 +1558,8 @@ get_timezone (void) } /* Handle time-server tags. - * - * Sets tags_data->timestamp to the correct time (in unix time). + * + * Sets tags_data->timestamp to the correct time (in unix time). * This received time is always in UTC. * * See http://ircv3.atheme.org/extensions/server-time-3.2 @@ -1573,7 +1574,7 @@ handle_message_tag_time (const char *time, message_tags_data *tags_data) */ if (!*time) return; - + if (time[strlen (time) - 1] == 'Z') { /* as defined in the specification */ @@ -1623,7 +1624,7 @@ handle_message_tag_time (const char *time, message_tags_data *tags_data) /* Handle message tags. * - * See http://ircv3.atheme.org/specification/message-tags-3.2 + * See http://ircv3.atheme.org/specification/message-tags-3.2 */ static char * message_tag_unescape (const char *value) @@ -1778,7 +1779,7 @@ irc_inline (server *serv, char *buf, int len) if (!sep) goto xit; - + *sep = '\0'; buf = sep + 1; diff --git a/src/common/server.c b/src/common/server.c index ec6097fd..63b7ab95 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -21,6 +21,10 @@ * Inferno Nettverk A/S, Norway. All rights reserved. */ +#ifndef WIN32 +#define _POSIX_C_SOURCE 200809L +#endif + #include #include #include @@ -1804,7 +1808,7 @@ server_set_encoding (server *serv, char *new_encoding) if (new_encoding) { serv->encoding = g_strdup (new_encoding); - /* the serverlist GUI might have added a space + /* the serverlist GUI might have added a space and short description - remove it. */ space = strchr (serv->encoding, ' '); if (space) diff --git a/src/common/zoitechat.c b/src/common/zoitechat.c index af616c84..161cb8ff 100644 --- a/src/common/zoitechat.c +++ b/src/common/zoitechat.c @@ -16,6 +16,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#ifndef WIN32 +#define _POSIX_C_SOURCE 200809L +#endif + #include #include #include @@ -308,7 +312,7 @@ lastact_getfirst(int (*filter) (session *sess)) sess->lastact_idx = LACT_NONE; } } - + return sess; } @@ -360,7 +364,7 @@ lagcheck_update (void) { server *serv; GSList *list = serv_list; - + if (!prefs.hex_gui_lagometer) return; @@ -575,7 +579,7 @@ irc_init (session *sess) g_free (buf); g_free (arg_url); } - + if (arg_urls != NULL) { guint i; @@ -896,7 +900,7 @@ static char defaultconf_urlhandlers[] = #ifdef USE_SIGACTION /* Close and open log files on SIGUSR1. Usefull for log rotating */ -static void +static void sigusr1_handler (int signal, siginfo_t *si, void *un) { GSList *list = sess_list;