From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) (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 092F642EF5C for ; Mon, 29 Jun 2020 15:48:11 +0300 (MSK) Received: by mail-lj1-f196.google.com with SMTP id h22so10699646lji.9 for ; Mon, 29 Jun 2020 05:48:11 -0700 (PDT) Date: Mon, 29 Jun 2020 15:48:08 +0300 From: Cyrill Gorcunov Message-ID: <20200629124808.GA2256@grain> References: <20200629124419.23922-1-i.kosarev@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200629124419.23922-1-i.kosarev@tarantool.org> 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 Cc: tarantool-patches@dev.tarantool.org 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 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.