From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f67.google.com (mail-lf1-f67.google.com [209.85.167.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 8472742EF5C for ; Mon, 29 Jun 2020 15:49:27 +0300 (MSK) Received: by mail-lf1-f67.google.com with SMTP id g139so8988067lfd.10 for ; Mon, 29 Jun 2020 05:49:27 -0700 (PDT) Date: Mon, 29 Jun 2020 15:49:25 +0300 From: Cyrill Gorcunov Message-ID: <20200629124925.GB2256@grain> References: <20200629124419.23922-1-i.kosarev@tarantool.org> <20200629124808.GA2256@grain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200629124808.GA2256@grain> Subject: Re: [Tarantool-patches] [PATCH] xlog: make log directory if needed List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ilya Kosarev , tarantool-patches@dev.tarantool.org On Mon, Jun 29, 2020 at 03:48:09PM +0300, Cyrill Gorcunov wrote: > On Mon, Jun 29, 2020 at 03:44:19PM +0300, Ilya Kosarev wrote: > ... > > > > +/** Make missing directories from the path. */ > > +int > > +make_dir(char *path) > > +{ > > + char *path_sep = path; > > + while (*path_sep == '/') { > > + /* Don't create root */ > > + ++path_sep; > > + } > > There is a helper function, please make sure that Typo: this is a helper function. > 1) path is having EOS > 2) you don't go outside of path memory > > IOW, I think you should pass some @len parameter > as well and return -1 in case if path is full of '/' > symbols without EOS.