[gnu.utils.bug] minor changes for fileutils-1.0 under hp-ux

cph@zurich.ai.mit.edu (Chris Hanson) (02/09/90)

The following simple changes to "cp.c" and "mv.c" improve these
programs when used under hp-ux.  The programs work fine without the
changes, but they work better with them.

*** cp.c.~1~	Sat Feb  3 13:47:13 1990
--- cp.c	Thu Feb  8 13:44:08 1990
***************
*** 160,166 ****
        egid = getegid ();
        ngroups = 1;
        groups = (int *) xmalloc (ngroups * sizeof *groups);
! #ifdef USG
        *groups = getgid ();
  #else
        for (;;)
--- 160,166 ----
        egid = getegid ();
        ngroups = 1;
        groups = (int *) xmalloc (ngroups * sizeof *groups);
! #if defined(USG) && !defined(hpux)
        *groups = getgid ();
  #else
        for (;;)
***************
*** 748,754 ****
    /* ??? Since USG doesn't have ftruncate, this can't be done.
       This should be fixed.  */
  
! #ifndef USG
    if (write (target_desc, "", 1) != 1
        || ftruncate (target_desc, n_read_total) < 0)
      error ("cannot write", errno, dst_path, FATAL);
--- 748,754 ----
    /* ??? Since USG doesn't have ftruncate, this can't be done.
       This should be fixed.  */
  
! #if !defined(USG) || defined(hpux)
    if (write (target_desc, "", 1) != 1
        || ftruncate (target_desc, n_read_total) < 0)
      error ("cannot write", errno, dst_path, FATAL);


*** mv.c.~1~	Fri Feb  2 22:57:45 1990
--- mv.c	Thu Feb  8 13:44:07 1990
***************
*** 91,97 ****
    return (stat (fn, &stb) >= 0 && (stb.st_mode & S_IFMT) == S_IFDIR);
  }
  
! #ifdef USG
  
  int
  rename (from, to)
--- 91,97 ----
    return (stat (fn, &stb) >= 0 && (stb.st_mode & S_IFMT) == S_IFDIR);
  }
  
! #if defined(USG) && !defined(hpux)
  
  int
  rename (from, to)
***************
*** 311,317 ****
  	      error (0, errno, "cannot create `%s'", to);
  	      return;
  	    }
! #ifdef USG
  	  chmod (to, stbf.st_mode & 0777);	/* again, can't fail */
  #else
  	  fchmod (ofd, stbf.st_mode & 0777);	/* again, can't fail */
--- 311,317 ----
  	      error (0, errno, "cannot create `%s'", to);
  	      return;
  	    }
! #if defined(USG) && !defined(hpux)
  	  chmod (to, stbf.st_mode & 0777);	/* again, can't fail */
  #else
  	  fchmod (ofd, stbf.st_mode & 0777);	/* again, can't fail */