From 230a54d83e4e030647ae380735bc82e1b7e2691a Mon Sep 17 00:00:00 2001 From: insofaras Date: Tue, 23 Feb 2016 19:40:35 +0000 Subject: [PATCH] small fix for linux file writing --- linux_4ed.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linux_4ed.cpp b/linux_4ed.cpp index fd3cef09..deab87b4 100644 --- a/linux_4ed.cpp +++ b/linux_4ed.cpp @@ -679,7 +679,6 @@ Sys_Save_File_Sig(system_save_file){ return result; } - size_t remaining = size; do { ssize_t written = write(tmp_fd, data, size); if(written == -1){ @@ -691,9 +690,10 @@ Sys_Save_File_Sig(system_save_file){ return result; } } else { - remaining -= written; + size -= written; + data += written; } - } while(remaining); + } while(size); if(rename(tmp_fname, filename) == -1){ perror("system_save_file: rename");