xmppipe_roomname: use define for hostname

pull/1/head
Michael Santos 7 years ago
parent 5cb6364cd0
commit ad56bab3cc

@ -190,7 +190,7 @@ main(int argc, char **argv)
state->room = xmppipe_roomname("stdout"); state->room = xmppipe_roomname("stdout");
if (state->resource == NULL) if (state->resource == NULL)
state->resource = xmppipe_strdup("xmppipe"); state->resource = xmppipe_strdup(XMPPIPE_RESOURCE);
if (strchr(state->room, '@')) { if (strchr(state->room, '@')) {
state->out = xmppipe_strdup(state->room); state->out = xmppipe_strdup(state->room);

@ -22,6 +22,7 @@
#include <strophe.h> #include <strophe.h>
#define XMPPIPE_VERSION "0.8.0" #define XMPPIPE_VERSION "0.8.0"
#define XMPPIPE_RESOURCE "xmppipe"
#define XMPPIPE_STREQ(a,b) (strcmp((a),(b)) == 0) #define XMPPIPE_STREQ(a,b) (strcmp((a),(b)) == 0)
#define XMPPIPE_STRNEQ(a,b) (strcmp((a),(b)) != 0) #define XMPPIPE_STRNEQ(a,b) (strcmp((a),(b)) != 0)

@ -1,4 +1,4 @@
/* Copyright (c) 2015, Michael Santos <michael.santos@gmail.com> /* Copyright (c) 2015-2017, Michael Santos <michael.santos@gmail.com>
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -204,7 +204,7 @@ xmppipe_roomname(char *label)
buf = xmppipe_malloc(len); buf = xmppipe_malloc(len);
if (gethostname(name, sizeof(name)) < 0) { if (gethostname(name, sizeof(name)) < 0) {
(void)memcpy(name, "xmppipe", sizeof(name)-1); (void)snprintf(name, sizeof(name)-1, "%s", XMPPIPE_RESOURCE);
} }
name[sizeof(name)-1] = '\0'; name[sizeof(name)-1] = '\0';

Loading…
Cancel
Save