History

formats: release stdin/stdout reservation on close

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.

Nigel Kettlewell committed 10 years ago

Commit d68424f1 parent dd8b63b1 file · +8 −1Browse files

Unified · Split

src/formats.c+8−1
@@ -1057,8 +1057,15 @@ int sox_close(sox_format_t * ft) · 1056 unmodified lines
10571057 else result = ft->handler.stopwrite? (*ft->handler.stopwrite)(ft) : SOX_SUCCESS;
10581058 }
10591059
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) {
10611066 xfclose(ft->fp, ft->io_type);
1067+ }
1068+
10621069 free(ft->priv);
10631070 free(ft->filename);
10641071 free(ft->filetype);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t