-r is working

This commit is contained in:
elvis
2022-04-27 21:18:25 +02:00
parent 5151418090
commit 8841ca95a0
8 changed files with 65 additions and 43 deletions

View File

@ -63,8 +63,7 @@ size_t taglia_write(taglia_t *taglia, char *buf) {
}
size_t n = 0;
pthread_mutex_lock(&taglia->m);
if ((n = fwrite(buf, sizeof(char), strlen(buf)+1, taglia->file)) < 0) {
// strlen conta il numero di caratteri senza EOF quindi aggiungiamo 1
if ((n = fwrite(buf, sizeof(char), strlen(buf), taglia->file)) < 0) {
perror("fwrite");
goto _error_write;
}
@ -111,8 +110,7 @@ size_t taglia_log(taglia_t *taglia, char *buf) {
goto _error_taglia_log_mutex;
}
if((m = fwrite(buf, sizeof(char), strlen(buf)+1, taglia->file)) < 0){
// strlen conta il numero di caratteri senza EOF quindi aggiungiamo 1
if((m = fwrite(buf, sizeof(char), strlen(buf), taglia->file)) < 0){
perror("ERROR: fwrite");
goto _error_taglia_log_mutex;
}