nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 4ede3b494f3767d841edd43f1fcf630803ee2a49
parent 452066bc88282173c5c7d6f622fdbc3875e5c977
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Fri,  6 Nov 2015 20:14:37 +0000

Truncating an overlong hostname properly instead of bailing out
when writing a lock file.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5391 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
MChangeLog | 5+++++
Msrc/files.c | 8++++++--
2 files changed, 11 insertions(+), 2 deletions(-)

diff --git 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 @@ -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...*/