Yes. absolutely.. ok

On Thu, Feb 14, 2013 at 1:38 PM, Miod Vallat <m...@online.fr> wrote:
> This is what happens when install(1) is used to install files on a
> read-only filesystem:
>
> # mount -u -o ro /usr
> # cd /usr/src
> # make build
> cd /usr/src/share/mk && exec  make install
> install -c -o root -g bin -m 444 bsd.README bsd.dep.mk bsd.lib.mk bsd.man.mk 
> bsd.nls.mk  bsd.obj.mk bsd.own.mk bsd.port.arch.mk bsd.port.mk  
> bsd.port.subdir.mk bsd.prog.mk  bsd.regress.mk bsd.subdir.mk bsd.sys.mk 
> sys.mk bsd.lkm.mk  bsd.xconf.mk bsd.xorg.mk /usr/share/mk
> install: /usr/share/mk/bsd.README: File exists
> *** Error 71 in share/mk (Makefile:13 'install')
> *** Error 1 in /usr/src (Makefile:78 'build')
> #
>
> Not really helpful. With the diff below, I will now get:
>
> install: /usr/share/mk/bsd.README: Read-only file system
>
> which helps figuring out what is wrong.
>
> Miod
>
> Index: xinstall.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/xinstall/xinstall.c,v
> retrieving revision 1.52
> diff -u -p -r1.52 xinstall.c
> --- xinstall.c  14 Sep 2012 00:00:29 -0000      1.52
> +++ xinstall.c  14 Feb 2013 20:32:21 -0000
> @@ -639,8 +639,10 @@ create_newfile(char *path, struct stat *
>                 /* It is ok for the target file not to exist. */
>                 if (rename(path, backup) < 0 && errno != ENOENT)
>                         err(EX_OSERR, "rename: %s to %s (errno %d)", path, 
> backup, errno);
> -       } else
> -               (void)unlink(path);
> +       } else {
> +               if (unlink(path) < 0 && errno != ENOENT)
> +                       err(EX_OSERR, "%s", path);
> +       }
>
>         return(open(path, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR));
>  }
>

Reply via email to