From 3116d2f7de1599b719d8afd7bb553b8c2841c811 Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Thu, 3 Jan 2013 04:36:39 +0000 Subject: [PATCH] Fix impromper calls to nmalloc in new locking implementation. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4556 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- src/files.c | 6 +++--- src/global.c | 4 ++-- src/proto.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/files.c b/src/files.c index 1d9e08fb..55e7939d 100644 --- a/src/files.c +++ b/src/files.c @@ -250,7 +250,7 @@ int do_lockfile(const char *filename) char *lockbase = basename((char *) mallocstrcpy(NULL, filename)); ssize_t lockfilesize = (sizeof (char *) * (strlen(filename) + strlen(locking_prefix) + strlen(locking_suffix) + 3)); - char *lockfilename = nmalloc(lockfilesize); + char *lockfilename = (char *) nmalloc(lockfilesize); char lockprog[12], lockuser[16]; struct stat fileinfo; int lockfd, lockpid; @@ -264,8 +264,8 @@ int do_lockfile(const char *filename) if (stat(lockfilename, &fileinfo) != -1) { ssize_t readtot = 0; ssize_t readamt = 0; - char *lockbuf = nmalloc(8192); - char *promptstr = nmalloc(128); + char *lockbuf = (char *) nmalloc(8192); + char *promptstr = (char *) nmalloc(128); int ans; if ((lockfd = open(lockfilename, O_RDONLY)) < 0) { statusbar(_("Error opening lockfile %s: %s"), diff --git a/src/global.c b/src/global.c index a54f6f92..566a8163 100644 --- a/src/global.c +++ b/src/global.c @@ -131,9 +131,9 @@ ssize_t tabsize = -1; char *backup_dir = NULL; /* The directory where we store backup files. */ -char *locking_prefix = "."; +const char *locking_prefix = "."; /* Prefix of how to store the vim-style lock file */ -char *locking_suffix = ".swp"; +const char *locking_suffix = ".swp"; /* Suffix of the vim-style lock file */ #endif #ifndef DISABLE_OPERATINGDIR diff --git a/src/proto.h b/src/proto.h index b27c9d00..94e592c4 100644 --- a/src/proto.h +++ b/src/proto.h @@ -85,8 +85,8 @@ extern ssize_t tabsize; #ifndef NANO_TINY extern char *backup_dir; -extern char *locking_prefix; -extern char *locking_suffix; +extern const char *locking_prefix; +extern const char *locking_suffix; #endif #ifndef DISABLE_OPERATINGDIR extern char *operating_dir; -- 2.39.5