[alsa-devel] [PATCH] crecord: truncate file to remove content of existing file
Without O_TRUNC overwriting bigger file by smaller one doesn't wipe the old file fully.
Signed-off-by: Piotr Maziarz piotrx.maziarz@linux.intel.com Signed-off-by: Cezary Rojewski cezary.rojewski@intel.com --- src/utils/crecord.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/utils/crecord.c b/src/utils/crecord.c index 12ad961..abaafea 100644 --- a/src/utils/crecord.c +++ b/src/utils/crecord.c @@ -323,7 +323,7 @@ static void capture_samples(char *name, unsigned int card, unsigned int device, if (!name) { file = STDOUT_FILENO; } else { - file = open(name, O_RDWR | O_CREAT, + file = open(name, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); if (file == -1) { fprintf(stderr, "Unable to open file '%s'\n", name);
participants (1)
-
Piotr Maziarz