working -u -l -c

This commit is contained in:
elvis
2022-04-30 00:37:59 +02:00
parent 6bf73e8d18
commit 85231d073f
6 changed files with 11 additions and 10 deletions

View File

@ -1147,7 +1147,8 @@ int removeFile(const char* pathname) {
} else {
openedFiles->numOfFiles--;
}
freeResponse(res);
free(res);
free(cmd);
return 0;
}

View File

@ -733,7 +733,7 @@ void removeFile(char *filepath, queueT *q, long fd_c, taglia_t *taglia, pthread_
}
if (removeFileFromQueue(q, filepath, fd_c) == -1) {
n += snprintf(tmp_buf+n, m-n, "Client %ld ha richiesto una removeFile sul file \"%s\" e' terminata con errore.\n", fd_c, filepath);
n += snprintf(tmp_buf+n, m-n, "Client %ld ha richiesto una removeFile sul file \"%s\" e' terminata con errore del server.\n", fd_c, filepath);
serror(MENT, fd_c, taglia, tmp_buf);
return;
}

View File

@ -682,8 +682,8 @@ int removeFileFromQueue(queueT *q, char *filepath, int owner) {
goto _end_remove_file_queue;
}
if ((tmp->data)->open != 0 || ((tmp->data)->O_LOCK && (tmp->data)->owner != owner)) {
// if file è aperto o la lock non è del owner
if (((tmp->data)->O_LOCK) && ((tmp->data)->owner != owner)) {
// if lock non è del owner
errno = EPERM;
goto _end_remove_file_queue;
}