Upgrade progress status is set by calling a binary in a child process.
Its output messes with that of the parent.
Change-Id: I9b73c129e35b57d955183f3298ad76db17b2f1a0
}
if (pid == 0) {
+ // The binary we are about to launch prints unnecessary stuff to stdout
+ int fd;
+ if (((fd = open("/dev/null", O_WRONLY)) < 0) || (dup2(fd, STDOUT_FILENO) < 0)
+ || (close(fd) < 0)) {
+ fprintf(stderr, "Child failed to redirect stdout\n");
+ exit(EXIT_FAILURE);
+ }
+
// Max value for progress is 100
char buf[4];
snprintf(buf, sizeof(buf), "%d", progress);