A bunch of fixes from NetBSD:
A bunch of fixes from NetBSD:

o Restore owner/group/mode/atime/mtime of symbolic links, rev. 1.30.
o Extract file flags of symbolic link, rev. 1.42.
o Call getfile() before altering file attributes.
  Open file with mode 0600 instead of 0666 so that file won't remain
  group or world readable/writable even if getfile() terminated.
  Move skipfile() before altering file attributes in IF{CHR,BLK} and
  IFIFO case for symmetry, rev. 1.32.
o Use file mode 0600 when creating special file or fifo, revs. 1.33, 1.34.

o Remove redundant -N check.

PR:		bin/101660
Submitted by:	Andrey V. Elsukov
Obtained from:	NetBSD, enami@netbsd
MFC after:	6 weeks

jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase