On Thu, Feb 11, 2016 at 01:57:00PM +0100, Mattias Andrée wrote: > It cannot be `install` because it conflicts with > install rule. So I decided to append .out (like in a.out) > to make it work.
Duh, of course. > > > +static void > > > +make_dir(char *dir, int was_missing) > > > +{ > > > + if (!mkdir(dir, was_missing ? 0755 : mode)) { > > > + if (!was_missing && (lchown(dir, > > > owner, group) < 0)) > > > + eprintf("lchmod %s:", dir); > > > + } else if (errno != EEXIST) { > > > + eprintf("mkdir %s:", dir); > > > + } > > > +} > > > + > > > +static void > > > +make_dirs(char *dir, int was_missing) > > > +{ > > > + char *p; > > > + for (p = strchr(dir + (dir[0] == '/'), '/'); > > > p; p = strchr(p + 1, '/')) { > > > + *p = '\0'; > > > + make_dir(dir, was_missing); > > > + *p = '/'; > > > + } > > > + make_dir(dir, was_missing); > > > +} > > > > Can we use mkdirp() from libutil? > > mkdirp has to be change to allow custom > mode, but it also has to be change to > optioanlly do lchown. I though this was > better because other utilities will probably > not need this. Makes sense to keep it as is then.