Fix error where level wasnt define before request.

This commit is contained in:
Afonso Clerigo Mendes de Sousa 2025-02-27 20:27:33 +00:00
parent 79b420fca3
commit fafc45b720

View File

@ -173,19 +173,20 @@ int main(void)
req.type = 0; req.type = 0;
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.ID = 0; req.ID = 0;
req.level = 1;
send(sockfd, &req, sizeof(Request), 0); send(sockfd, &req, sizeof(Request), 0);
// Receive response from the server // Receive response from the server
recv(sockfd, &req, sizeof(req), 0); recv(sockfd, &req, sizeof(req), 0);
if (req.level == -1) if (req.level == -1)
{ {
printf("No existing passwords, use \"addpass\" command to add a password to the list.\n"); printf("No existing passwords with, use \"addpass\" command to add a password to the list.\n");
} }
else else
{ {
printf("Level: %d\tKey: %s\n", req.level, req.key); printf("Level: %d\tKey: %s\n", req.level, req.key);
} }
printf("<------->\n\n"); printf("<------->\n\n");
choice = prompNormalRequest(">> "); choice = prompNormalRequest(">> ");
if (strcmp(choice, "exit") == 0 || strcmp(choice, "quit") == 0 || strcmp(choice, "q") == 0) if (strcmp(choice, "exit") == 0 || strcmp(choice, "quit") == 0 || strcmp(choice, "q") == 0)