Print this page
1150 libcmdutils has superfluous #define
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Marcel Telka <marcel@telka.sk>

@@ -35,12 +35,10 @@
  * University Acknowledgment- Portions of this document are derived from
  * software developed by the University of California, Berkeley, and its
  * contributors.
  */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 #include "libcmdutils.h"
 
 
 int
 writefile(int fi, int fo, char *infile, char *outfile, char *asfile,

@@ -96,11 +94,11 @@
                     outfile, dgettext(TEXT_DOMAIN, " attribute "), atfile);
         } else {
                 (void) snprintf(targbuf, targ_size, "%s", outfile);
         }
 
-        if (ISREG(*s1p) && s1p->st_size > SMALLFILESIZE) {
+        if (S_ISREG(s1p->st_mode) && s1p->st_size > SMALLFILESIZE) {
                 /*
                  * Determine size of initial mapping.  This will determine the
                  * size of the address space chunk we work with.  This initial
                  * mapping size will be used to perform munmap() in the future.
                  */

@@ -138,11 +136,11 @@
                                                 else
                                                         perror(srcbuf);
                                                 (void) close(fi);
                                                 (void) close(fo);
                                                 (void) munmap(cp, munmapsize);
-                                                if (ISREG(*s2p))
+                                                if (S_ISREG(s2p->st_mode))
                                                         (void) unlink(targbuf);
                                                 return (1);
                                         }
                                         remains -= nbytes;
                                         if (remains == 0)

@@ -162,11 +160,11 @@
                                 else
                                         perror(targbuf);
                                 (void) close(fi);
                                 (void) close(fo);
                                 (void) munmap(cp, munmapsize);
-                                if (ISREG(*s2p))
+                                if (S_ISREG(s2p->st_mode))
                                         (void) unlink(targbuf);
                                 if (srcbuf != NULL)
                                         free(srcbuf);
                                 if (targbuf != NULL)
                                         free(targbuf);

@@ -182,11 +180,11 @@
                             MAP_FIXED, fi, offset) == MAP_FAILED) {
                                 perror(srcbuf);
                                 (void) close(fi);
                                 (void) close(fo);
                                 (void) munmap(cp, munmapsize);
-                                if (ISREG(*s2p))
+                                if (S_ISREG(s2p->st_mode))
                                         (void) unlink(targbuf);
                                 if (srcbuf != NULL)
                                         free(srcbuf);
                                 if (targbuf != NULL)
                                         free(targbuf);

@@ -201,21 +199,21 @@
                         if (n == 0) {
                                 return (0);
                         } else if (n < 0) {
                                 (void) close(fi);
                                 (void) close(fo);
-                                if (ISREG(*s2p))
+                                if (S_ISREG(s2p->st_mode))
                                         (void) unlink(targbuf);
                                 if (srcbuf != NULL)
                                         free(srcbuf);
                                 if (targbuf != NULL)
                                         free(targbuf);
                                 return (1);
                         } else if (write(fo, buf, n) != n) {
                                 (void) close(fi);
                                 (void) close(fo);
-                                if (ISREG(*s2p))
+                                if (S_ISREG(s2p->st_mode))
                                         (void) unlink(targbuf);
                                 if (srcbuf != NULL)
                                         free(srcbuf);
                                 if (targbuf != NULL)
                                         free(targbuf);