Reset the stdin/out_in_use_by globals when closing the associated file, letting stdin/out be opened again. Without this, they remain blocked forever once opened.
Unified · Split
| @@ -1057,8 +1057,15 @@ int sox_close(sox_format_t * ft) · 1056 unmodified lines | |||
| 1057 | else result = ft->handler.stopwrite? (*ft->handler.stopwrite)(ft) : SOX_SUCCESS; | 1057 | else result = ft->handler.stopwrite? (*ft->handler.stopwrite)(ft) : SOX_SUCCESS; |
| 1058 | } | 1058 | } |
| 1059 | 1059 | ||
| 1060 | if (ft->fp && ft->fp != stdin && ft->fp != stdout) | 1060 | if (ft->fp == stdin) { |
| 1061 | sox_globals.stdin_in_use_by = NULL; | ||
| 1062 | } else if (ft->fp == stdout) { | ||
| 1063 | fflush(stdout); | ||
| 1064 | sox_globals.stdout_in_use_by = NULL; | ||
| 1065 | } else if (ft->fp) { | ||
| 1061 | xfclose(ft->fp, ft->io_type); | 1066 | xfclose(ft->fp, ft->io_type); |
| 1067 | } | ||
| 1068 | |||
| 1062 | free(ft->priv); | 1069 | free(ft->priv); |
| 1063 | free(ft->filename); | 1070 | free(ft->filename); |
| 1064 | free(ft->filetype); | 1071 | free(ft->filetype); |