- goto done;
- case 0:
- if(dup2(fd[1], 1) == -1 || dup2(dbfd(), 2) == -1) {
- changer_resultstr = vstralloc ("<error> ",
- "could not open pipe to \"",
- cmdstr,
- "\": ",
- strerror(errno),
- NULL);
- (void)fullwrite(fd[1], changer_resultstr, strlen(changer_resultstr));
- exit(1);
- }
- aclose(fd[0]);
- aclose(fd[1]);
- if(config_dir && chdir(config_dir) == -1) {
- changer_resultstr = vstralloc ("<error> ",
- "could not cd to \"",
- config_dir,
- "\": ",
- strerror(errno),
- NULL);
- (void)fullwrite(2, changer_resultstr, strlen(changer_resultstr));
- exit(1);
- }
- if(arg) {
- execle(tapechanger, tapechanger, cmd, arg, (char *)NULL,
- safe_env());
- } else {
- execle(tapechanger, tapechanger, cmd, (char *)NULL, safe_env());
- }
- changer_resultstr = vstralloc ("<error> ",
- "could not exec \"",
- tapechanger,
- "\": ",
- strerror(errno),
- NULL);
- (void)fullwrite(2, changer_resultstr, strlen(changer_resultstr));
- exit(1);
- default:
- aclose(fd[1]);
- }
-
- if((changer_resultstr = areads(fd[0])) == NULL) {
- changer_resultstr = vstralloc ("<error> ",
- "could not read result from \"",
- tapechanger,
- errno ? "\": " : "\"",
- errno ? strerror(errno) : "",
- NULL);