Check that we actually do write the inprogress-lock.

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@560 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Pasi Kallinen 2010-05-08 05:27:50 +00:00
parent cb963b5da8
commit 6cb4d79c94
1 changed files with 7 additions and 2 deletions

View File

@ -205,12 +205,14 @@ gen_inprogress_lock (int game, pid_t pid, char* ttyrec_filename)
{
char *lockfile = NULL, filebuf[80];
int fd;
size_t len;
size_t len, wrlen;
struct flock fl = { 0 };
snprintf (filebuf, sizeof(filebuf), "%d\n%d\n%d\n",
pid, win.ws_row, win.ws_col);
wrlen = strlen(filebuf);
fl.l_type = F_WRLCK;
fl.l_whence = SEEK_SET;
fl.l_start = 0;
@ -228,7 +230,10 @@ gen_inprogress_lock (int game, pid_t pid, char* ttyrec_filename)
graceful_exit (68);
}
write (fd, filebuf, strlen (filebuf));
if (write (fd, filebuf, wrlen) != wrlen) {
debug_write("inprogress-lock write");
graceful_exit(70);
}
return lockfile;
}