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.
master
David Lawrence Ramsey 2016-12-08 13:30:59 -06:00 committed by Benno Schulenberg
parent ecccb8d027
commit 84d6f1a5b6
2 changed files with 6 additions and 6 deletions

View File

@ -179,8 +179,8 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
struct stat fileinfo; struct stat fileinfo;
char *lockdata = charalloc(1024); char *lockdata = charalloc(1024);
char myhostname[32]; char myhostname[32];
ssize_t lockdatalen = 1024; size_t lockdatalen = 1024;
ssize_t wroteamt; size_t wroteamt;
mypid = getpid(); mypid = getpid();
myuid = geteuid(); myuid = geteuid();
@ -320,8 +320,8 @@ int do_lockfile(const char *filename)
fprintf(stderr, "lock file name is %s\n", lockfilename); fprintf(stderr, "lock file name is %s\n", lockfilename);
#endif #endif
if (stat(lockfilename, &fileinfo) != -1) { if (stat(lockfilename, &fileinfo) != -1) {
ssize_t readtot = 0; size_t readtot = 0;
ssize_t readamt = 0; size_t readamt = 0;
char *lockbuf, *question, *pidstring, *postedname, *promptstr; char *lockbuf, *question, *pidstring, *postedname, *promptstr;
int room, response; int room, response;

View File

@ -642,8 +642,8 @@ filestruct *fsfromline(ssize_t lineno)
f = f->next; f = f->next;
if (f->lineno != lineno) { if (f->lineno != lineno) {
statusline(ALERT, _("Internal error: can't match line %d. " statusline(ALERT, _("Internal error: can't match line %ld. "
"Please save your work."), lineno); "Please save your work."), (long)lineno);
return NULL; return NULL;
} }