Fix turn off for empty message

Always failed with an empty message, due to misuse of fwrite().
Broken in commit df7dc203, v4.2.20.
This commit is contained in:
Markus Armbruster 2009-02-08 17:04:03 +01:00
parent cfa0838977
commit 421119e1f1

View file

@ -111,8 +111,8 @@ turn(void)
memset(&tgm, 0, sizeof(tgm));
time(&tgm.tel_date);
tgm.tel_length = len;
if ((fwrite(&tgm, sizeof(tgm), 1, fptr) != 1) ||
(fwrite(msgbuf, tgm.tel_length, 1, fptr) != 1)) {
if (fwrite(&tgm, sizeof(tgm), 1, fptr) != 1 ||
fwrite(msgbuf, 1, tgm.tel_length, fptr) != tgm.tel_length) {
fclose(fptr);
pr("Something went wrong writing the message file.\n");
logerror("Could not properly write message file (%s).\n",