From 1755ff603bff086a19b3fbb39adc5f8022640159 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Sun, 15 Aug 1999 05:23:22 +0000 Subject: Fix the hostname part. 1999-08-15 Miguel de Icaza * calobj.c (ical_gen_uid): Fix the hostname part. svn path=/trunk/; revision=1116 --- calendar/ChangeLog | 4 ++++ calendar/cal-util/calobj.c | 6 +++--- calendar/calobj.c | 6 +++--- calendar/pcs/calobj.c | 6 +++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 2bb6396715..282f0871b0 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,7 @@ +1999-08-15 Miguel de Icaza + + * calobj.c (ical_gen_uid): Fix the hostname part. + 1999-08-07 Peter Teichman * calendar-pilot-sync.c (sync_pilot): sync correctly for objects diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c index f1bec05c2b..7e1a3635db 100644 --- a/calendar/cal-util/calobj.c +++ b/calendar/cal-util/calobj.c @@ -25,9 +25,9 @@ ical_gen_uid (void) if (!hostname){ char buffer [128]; - gethostname (buffer, sizeof (buffer)-1); - if (hostname) - hostname = g_strdup (hostname); + if ((gethostname (buffer, sizeof (buffer)-1) == 0) && + (buffer [0] != 0)) + hostname = g_strdup (buffer); else hostname = g_strdup ("localhost"); } diff --git a/calendar/calobj.c b/calendar/calobj.c index f1bec05c2b..7e1a3635db 100644 --- a/calendar/calobj.c +++ b/calendar/calobj.c @@ -25,9 +25,9 @@ ical_gen_uid (void) if (!hostname){ char buffer [128]; - gethostname (buffer, sizeof (buffer)-1); - if (hostname) - hostname = g_strdup (hostname); + if ((gethostname (buffer, sizeof (buffer)-1) == 0) && + (buffer [0] != 0)) + hostname = g_strdup (buffer); else hostname = g_strdup ("localhost"); } diff --git a/calendar/pcs/calobj.c b/calendar/pcs/calobj.c index f1bec05c2b..7e1a3635db 100644 --- a/calendar/pcs/calobj.c +++ b/calendar/pcs/calobj.c @@ -25,9 +25,9 @@ ical_gen_uid (void) if (!hostname){ char buffer [128]; - gethostname (buffer, sizeof (buffer)-1); - if (hostname) - hostname = g_strdup (hostname); + if ((gethostname (buffer, sizeof (buffer)-1) == 0) && + (buffer [0] != 0)) + hostname = g_strdup (buffer); else hostname = g_strdup ("localhost"); } -- cgit