diff --git a/ChangeLog b/ChangeLog index 1ce315ec74a1bf1bc780a6d8896f0cefd27472e0..08d21b2fd06a84e6e095f2dbb23f3d9843671933 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-11-06 Benno Schulenberg <bensberg@justemail.net> + * src/files.c (write_lockfile): Don't bail out when the hostname is + overlong, but instead truncate it properly and continue. This fixes + Ubuntu bug #1509081 reported by Sam Reed. + 2015-11-02 Benno Schulenberg <bensberg@justemail.net> * src/nano.h: Delete an unused type definition. * src/nano.h: Improve several comments. diff --git a/src/files.c b/src/files.c index cc8408977d2a8023d329f9dcacd763e4fb033e44..25c5aaac654c250cda690189584d2b32880d283d 100644 --- a/src/files.c +++ b/src/files.c @@ -136,8 +136,12 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi mypid = getpid(); if (gethostname(myhostname, 31) < 0) { - statusbar(_("Couldn't determine hostname for lock file: %s"), strerror(errno)); - goto free_and_fail; + if (errno == ENAMETOOLONG) + myhostname[31] = '\0'; + else { + statusbar(_("Couldn't determine hostname for lock file: %s"), strerror(errno)); + goto free_and_fail; + } } /* Check if the lock exists before we try to delete it...*/