Skip to content

Commit

Permalink
fix save logic
Browse files Browse the repository at this point in the history
  • Loading branch information
colinleroy committed Jan 29, 2025
1 parent cb59d42 commit 4ea51eb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/mastodon/cli/login.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,18 @@ static int save_settings(void) {

r = write(fd, &login_data, sizeof(login_data));

if (r < 0 || close(fd) != 0) {
if (r != sizeof(login_data)) {
close(fd);
err_close:
clrscr();
dputs("Could not save settings file.\r\n");
cgetc();
return -1;
}
if (close(fd) != 0) {
goto err_close;
}

return 0;
}

Expand Down

0 comments on commit 4ea51eb

Please sign in to comment.