Skip to content

Commit

Permalink
feat: write snapshot to fd
Browse files Browse the repository at this point in the history
  • Loading branch information
mhofman committed Apr 28, 2023
1 parent 399126f commit 1959e1c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion xsnap/sources/xsnap-worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,17 @@ int main(int argc, char* argv[])
#endif
path = nsbuf + 1;
SnapshotStream stream;
stream.file = fopen(path, "wb");
if (path[0] == '@') {
int fd = atoi(path + 1);
int tmpfd = dup(fd);
if (tmpfd < 0) {
stream.file = NULL;
} else {
stream.file = fdopen(tmpfd, "ab");
}
} else {
stream.file = fopen(path, "wb");
}
stream.size = 0;
if (stream.file) {
snapshot.stream = &stream;
Expand Down

0 comments on commit 1959e1c

Please sign in to comment.