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
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);

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