diff --git a/Secured/secured_transaction.c b/Secured/secured_transaction.c index 0ba3338..718e9db 100644 --- a/Secured/secured_transaction.c +++ b/Secured/secured_transaction.c @@ -19,7 +19,7 @@ void read_account(int fd, int index, char *name, int *balance) { lockf(fd, F_LOCK, ACCOUNT_SIZE); lseek(fd, index * ACCOUNT_SIZE, SEEK_SET); read(fd, buffer, ACCOUNT_SIZE); - sscanf(buffer, "%10s %d", name, balance); + sscanf(buffer, "%7s %d", name, balance); // Libérer le verrou après lecture lockf(fd, F_ULOCK, ACCOUNT_SIZE); } @@ -29,7 +29,7 @@ void write_account(int fd, int index, const char *name, int balance) { char buffer[ACCOUNT_SIZE]; // Formater la chaîne avec un nom de 10 caractères et un solde de 5 caractères, espace rempli si nécessaire - snprintf(buffer, ACCOUNT_SIZE, "%-10s%5d", name, balance); + snprintf(buffer, ACCOUNT_SIZE, "%-7s%7d", name, balance); // S'assurer que le buffer est exactement de taille ACCOUNT_SIZE for (int i = strlen(buffer); i < ACCOUNT_SIZE - 1; i++) { @@ -89,7 +89,7 @@ void process_transactions(int transactions, int account_count) { for (int i = 0; i < transactions; i++) { perform_transaction(fd, account_count); - usleep(rand() % 100000); // Temporisation aléatoire + //usleep(rand() % 100000); // Temporisation aléatoire } close(fd);