mirror of
https://github.com/alsa-project/alsa-utils
synced 2025-01-03 15:09:46 +01:00
alsabat: fix fopen and messages
All files should be opened in either "rb" or "wb" in current usage. Remove incorrect and unneccesary prints. Signed-off-by: Lu, Han <han.lu@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
bd6c706606
commit
f2f6583ee6
3 changed files with 9 additions and 11 deletions
11
bat/alsa.c
11
bat/alsa.c
|
@ -303,8 +303,8 @@ static int write_to_pcm_loop(struct pcm_container *sndpcm, struct bat *bat)
|
|||
fp = fopen(bat->debugplay, "wb");
|
||||
err = -errno;
|
||||
if (fp == NULL) {
|
||||
fprintf(bat->err, _("Cannot open file for capture: "));
|
||||
fprintf(bat->err, _("%s %d\n"), bat->debugplay, err);
|
||||
fprintf(bat->err, _("Cannot open file: %s %d\n"),
|
||||
bat->debugplay, err);
|
||||
return err;
|
||||
}
|
||||
/* leave space for wav header */
|
||||
|
@ -404,8 +404,7 @@ void *playback_alsa(struct bat *bat)
|
|||
bat->fp = fopen(bat->playback.file, "rb");
|
||||
err = -errno;
|
||||
if (bat->fp == NULL) {
|
||||
fprintf(bat->err, _("Cannot open file for capture: "));
|
||||
fprintf(bat->err, _("%s %d\n"),
|
||||
fprintf(bat->err, _("Cannot open file: %s %d\n"),
|
||||
bat->playback.file, err);
|
||||
retval_play = 1;
|
||||
goto exit3;
|
||||
|
@ -545,10 +544,10 @@ void *record_alsa(struct bat *bat)
|
|||
}
|
||||
|
||||
remove(bat->capture.file);
|
||||
fp = fopen(bat->capture.file, "w+");
|
||||
fp = fopen(bat->capture.file, "wb");
|
||||
err = -errno;
|
||||
if (fp == NULL) {
|
||||
fprintf(bat->err, _("Cannot open file for capture: %s %d\n"),
|
||||
fprintf(bat->err, _("Cannot open file: %s %d\n"),
|
||||
bat->capture.file, err);
|
||||
retval_record = 1;
|
||||
goto exit3;
|
||||
|
|
|
@ -296,7 +296,7 @@ int analyze_capture(struct bat *bat)
|
|||
bat->fp = fopen(bat->capture.file, "rb");
|
||||
err = -errno;
|
||||
if (bat->fp == NULL) {
|
||||
fprintf(bat->err, _("Cannot open file for capture: %s %d\n"),
|
||||
fprintf(bat->err, _("Cannot open file: %s %d\n"),
|
||||
bat->capture.file, err);
|
||||
goto exit1;
|
||||
}
|
||||
|
|
|
@ -469,8 +469,8 @@ static int bat_init(struct bat *bat)
|
|||
bat->log = fopen(bat->logarg, "wb");
|
||||
err = -errno;
|
||||
if (bat->log == NULL) {
|
||||
fprintf(bat->err, _("Cannot open file for capture:"));
|
||||
fprintf(bat->err, _(" %s %d\n"), bat->logarg, err);
|
||||
fprintf(bat->err, _("Cannot open file: %s %d\n"),
|
||||
bat->logarg, err);
|
||||
return err;
|
||||
}
|
||||
bat->err = bat->log;
|
||||
|
@ -533,8 +533,7 @@ static int bat_init(struct bat *bat)
|
|||
bat->fp = fopen(bat->playback.file, "rb");
|
||||
err = -errno;
|
||||
if (bat->fp == NULL) {
|
||||
fprintf(bat->err, _("Cannot open file for playback:"));
|
||||
fprintf(bat->err, _(" %s %d\n"),
|
||||
fprintf(bat->err, _("Cannot open file: %s %d\n"),
|
||||
bat->playback.file, err);
|
||||
return err;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue