Signed-off-by: David Goulet <dgoulet@efficios.com>
}
ret = gethostname(new_session->hostname, sizeof(new_session->hostname));
- if (ret && errno == ENAMETOOLONG) {
- new_session->hostname[HOST_NAME_MAX - 1] = '\0';
+ if (ret < 0) {
+ if (errno == ENAMETOOLONG) {
+ new_session->hostname[sizeof(new_session->hostname) - 1] = '\0';
+ } else {
+ ret = LTTNG_ERR_FATAL;
+ goto error;
+ }
}
/* Init kernel session */
#ifndef _LTT_SESSION_H
#define _LTT_SESSION_H
+#include <limits.h>
#include <urcu/list.h>
#include <common/hashtable/hashtable.h>
*/
struct ltt_session {
char name[NAME_MAX];
- /* FIXME : size */
- char hostname[PATH_MAX]; /* local hostname, FIXME : could be useful to have that user defined too */
+ char hostname[HOST_NAME_MAX]; /* Local hostname. */
struct ltt_kernel_session *kernel_session;
struct ltt_ust_session *ust_session;
/*