From 84d6f1a5b6e4f2b37acf16ff1d7f128fd60c0355 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Thu, 8 Dec 2016 13:30:59 -0600
Subject: [PATCH] tweaks: adjust the type of four lockfile variables

The functions read() and fwrite() take size_t, not ssize_t.

And line numbers in the file should be displayed as a long type instead
of an int, since the effective type of ssize_t is not int, but long.
---
 src/files.c | 8 ++++----
 src/utils.c | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/files.c b/src/files.c
index 9f10cff2..8955e190 100644
--- a/src/files.c
+++ b/src/files.c
@@ -179,8 +179,8 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
     struct stat fileinfo;
     char *lockdata = charalloc(1024);
     char myhostname[32];
-    ssize_t lockdatalen = 1024;
-    ssize_t wroteamt;
+    size_t lockdatalen = 1024;
+    size_t wroteamt;
 
     mypid = getpid();
     myuid = geteuid();
@@ -320,8 +320,8 @@ int do_lockfile(const char *filename)
     fprintf(stderr, "lock file name is %s\n", lockfilename);
 #endif
     if (stat(lockfilename, &fileinfo) != -1) {
-	ssize_t readtot = 0;
-	ssize_t readamt = 0;
+	size_t readtot = 0;
+	size_t readamt = 0;
 	char *lockbuf, *question, *pidstring, *postedname, *promptstr;
 	int room, response;
 
diff --git a/src/utils.c b/src/utils.c
index cbd5b55b..7c61cebf 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -642,8 +642,8 @@ filestruct *fsfromline(ssize_t lineno)
 	    f = f->next;
 
     if (f->lineno != lineno) {
-	statusline(ALERT, _("Internal error: can't match line %d.  "
-			"Please save your work."), lineno);
+	statusline(ALERT, _("Internal error: can't match line %ld.  "
+			"Please save your work."), (long)lineno);
 	return NULL;
     }
 
-- 
GitLab