[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: file permissions



Now onto my reply.

> while using xwoe to edit some system config files today, everything I
> touched stopped working (ppp and uucp, which on SCO is used by ppp to
> dial out, and by getty for dial-in) bad bad bad! After some slightly
> panicy time I discovered that xwpe saves files with the ownership of the
> user if possible, since I was root, editing uucp, ppp, and other system
> config files, uucp files lost their ownership of "uucp:uucp", lp files
> lost their ownerships of "lp:bin" etc... and everything that I had
> edited became "root:sys", and everything that I had worked on stopped
> working.

During a save, xwpe first move the original file to filename + ".bak".
Then a new file is created that the content is saved to.  Thus the
backup file would retain the ownership not the created file.  This causes
problems with simlinks as well.

The function that does this is e_write in we_fl_fkt.c.  It calls remove
on the old backup then calls rename.  I haven't changed it mainly because
I like the speedy creation of backup files.  It never occured to me that
it would screw up ownership.  Guess it will have to copy the file.

Dennis Payne
dulsi@identicalsoftware.com


--- we_fl_fkt.c.orig	Thu Nov 11 22:01:13 1999
+++ we_fl_fkt.c	Tue Nov 16 21:22:35 1999
@@ -258,7 +258,7 @@
  {
   if (access(e_new_qual(ptmp, "bak", tmp), 0) == 0)
    remove(tmp);
-  rename(ptmp, tmp);
+  WpeRenameCopy(ptmp, tmp, f, 1);
  }
  if ((fp = fopen(ptmp, "wb")) == NULL)
  {