Skip to content

Commit

Permalink
Rip out unused fork_and_flush_buffer()
Browse files Browse the repository at this point in the history
It's never called.
  • Loading branch information
DemiMarie committed Apr 11, 2024
1 parent 2901f00 commit f42521d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
1 change: 0 additions & 1 deletion libqrexec/libqrexec-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ void *buffer_data(struct buffer *b);

int flush_client_data(int fd, struct buffer *buffer);
int write_stdin(int fd, const char *data, int len, struct buffer *buffer);
int fork_and_flush_stdin(int fd, struct buffer *buffer);

/**
* @brief Execute an already-parsed Qubes RPC command.
Expand Down
27 changes: 0 additions & 27 deletions libqrexec/write-stdin.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,30 +90,3 @@ int write_stdin(int fd, const char *data, int len, struct buffer *buffer)
}
return WRITE_STDIN_OK;
}

/*
* Data feed process has exited, so we need to clear all control structures for
* the client. However, if we have buffered data for the client (which is rare btw),
* fire&forget a separate process to flush them.
*/
int fork_and_flush_stdin(int fd, struct buffer *buffer)
{
int i;
if (!buffer_len(buffer))
return 0;
switch (fork()) {
case -1:
PERROR("fork");
exit(1);
case 0:
break;
default:
return 1;
}
for (i = 0; i < MAX_FDS; i++)
if (i != fd && i != 2)
close(i);
set_block(fd);
write_all(fd, buffer_data(buffer), buffer_len(buffer));
_exit(0);
}

0 comments on commit f42521d

Please sign in to comment.