From: Takashi Iwai Subject: Re: [PATCH] topology: open topology files with O_TRUNC Date: Wed, 18 Nov 2015 14:58:02 +0100 Message-ID: References: <1447854166-6533-1-git-send-email-vinod.koul@intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id E55D826572D for ; Wed, 18 Nov 2015 14:58:02 +0100 (CET) In-Reply-To: <1447854166-6533-1-git-send-email-vinod.koul@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Vinod Koul Cc: liam.r.girdwood@linux.intel.com, patches.audio@intel.com, alsa-devel@alsa-project.org, broonie@kernel.org List-Id: alsa-devel@alsa-project.org On Wed, 18 Nov 2015 14:42:46 +0100, Vinod Koul wrote: > > The topology file if exists needs to rewritten, so we need to open these > files with O_TRUNC flag as well > > Signed-off-by: Vinod Koul Applied, thanks. Takashi > --- > src/topology/parser.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/topology/parser.c b/src/topology/parser.c > index 18bb9c79f3a8..ee2545aada1b 100644 > --- a/src/topology/parser.c > +++ b/src/topology/parser.c > @@ -260,7 +260,7 @@ int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile, > int err = 0; > > tplg->out_fd = > - open(outfile, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); > + open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR ); > if (tplg->out_fd < 0) { > SNDERR("error: failed to open %s err %d\n", > outfile, -errno); > @@ -328,7 +328,7 @@ int snd_tplg_build(snd_tplg_t *tplg, const char *outfile) > int err; > > tplg->out_fd = > - open(outfile, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); > + open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); > if (tplg->out_fd < 0) { > SNDERR("error: failed to open %s err %d\n", > outfile, -errno); > -- > 1.9.1 >