[BACK]Return to newsyslog.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / newsyslog

Diff for /src/usr.bin/newsyslog/newsyslog.c between version 1.77 and 1.78

version 1.77, 2004/04/05 19:41:50 version 1.78, 2004/04/06 22:23:04
Line 14 
Line 14 
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN   * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF   * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    *
  * Sponsored in part by the Defense Advanced Research Projects   * Sponsored in part by the Defense Advanced Research Projects
  * Agency (DARPA) and Air Force Research Laboratory, Air Force   * Agency (DARPA) and Air Force Research Laboratory, Air Force
  * Materiel Command, USAF, under agreement number F39502-99-1-0512.   * Materiel Command, USAF, under agreement number F39502-99-1-0512.
Line 829 
Line 830 
                         warn("can't rm %s", ent->log);                          warn("can't rm %s", ent->log);
         } else {          } else {
                 (void)snprintf(file1, sizeof(file1), "%s.0", oldlog);                  (void)snprintf(file1, sizeof(file1), "%s.0", oldlog);
                 if (noaction)                  if (noaction) {
                         printf("\tmv %s to %s\n", ent->log, file1);                          printf("\tmv %s to %s\n", ent->log, file1);
                 else if (movefile(ent->log, file1, ent->uid, ent->gid,                          printf("\tchmod %o %s\n", ent->permissions, file1);
                           if (ent->uid != (uid_t)-1 || ent->gid != (gid_t)-1)
                                   printf("\tchown %u:%u %s\n",
                                       ent->uid, ent->gid, file1);
                   } else if (movefile(ent->log, file1, ent->uid, ent->gid,
                     ent->permissions))                      ent->permissions))
                         warn("can't mv %s to %s", ent->log, file1);                          warn("can't mv %s to %s", ent->log, file1);
         }          }
Line 1335 
Line 1340 
         int i;          int i;
   
         /* try rename(2) first */          /* try rename(2) first */
         i = rename(from, to);          if (rename(from, to) == 0) {
         if (i == 0 || errno != EXDEV)                  if (chmod(to, perm))
                 return (i);                          warn("can't chmod %s", to);
                   if (owner_uid != (uid_t)-1 || group_gid != (gid_t)-1)
                           if (chown(to, owner_uid, group_gid))
                                   warn("can't chown %s", to);
                   return (0);
           } else if (errno != EXDEV)
                   return (-1);
   
         /* different filesystem, have to copy the file */          /* different filesystem, have to copy the file */
         if ((src = fopen(from, "r")) == NULL)          if ((src = fopen(from, "r")) == NULL)

Legend:
Removed from v.1.77  
changed lines
  Added in v.1.78