remove OSF1 support
[oweals/cde.git] / cde / programs / dtcm / server / svcmain.c
index 62230ad5b7b5f5add64bb7f304aa0d5fbf641b70..b7c08f4018b4a4bf7256a195e1e82a70ab6e9815 100644 (file)
@@ -16,7 +16,7 @@
  * details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with these librararies and programs; if not, write
+ * License along with these libraries and programs; if not, write
  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  * Floor, Boston, MA 02110-1301 USA
  */
 #endif /* _NETINET_IN_H */
 #endif
 
-#if defined(SunOS) || defined(USL) || defined(__uxp__)
+#if defined(SunOS)
 #include <netconfig.h>
 #include <netdir.h>
 #include <sys/stropts.h>
 #include <tiuser.h>
-#endif /* SunOS || USL || __uxp__ */
+#endif /* SunOS */
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -112,7 +112,7 @@ _GetGtime(char *timestr)
        }
 
        minute = atoi(&timestr[len - 2]);
-       timestr[len - 2] = NULL;
+       timestr[len - 2] = '\0';
        hour = atoi(timestr);
 
        if (hour > 23 || minute > 59)
@@ -273,7 +273,9 @@ init_dir()
        }
 
        /* Change current directory, so core file can be dumped. */
-       chdir (dir);
+       if(-1 == chdir (dir)) {
+               perror(strerror(errno));
+       }
 }
 
 /*
@@ -519,14 +521,12 @@ main(int argc, char **argv)
        SVCXPRT *udp_transp = (SVCXPRT *)-1;
        int     fd, error;
 
-#if defined(SunOS) || defined(USL) || defined(__uxp__)
+#if defined(SunOS)
        struct netconfig *nconf_udp;
        struct netconfig *nconf_tcp;
        struct t_info info;
-#if !defined(USL) || (defined(USL) && (OSMAJORVERSION > 1))
        char mname[FMNAMESZ+1];
-#endif
-#endif /* SunOS || USL */
+#endif /* SunOS */
 
        pw = (struct passwd *)getpwnam("daemon");
        gr = (struct group *)getgrnam("daemon");
@@ -546,8 +546,7 @@ main(int argc, char **argv)
 
                standalone = 0;
 
-#if defined(SunOS) || defined(USL) || defined(__uxp__)
-#if !defined(USL) || (defined(USL) && (OSMAJORVERSION > 1))
+#if defined(SunOS)
                /* we need a TLI endpoint rather than a socket */
                if (ioctl(0, I_LOOK, mname) != 0) {
                        perror("rpc.cmsd: ioctl failed to get module name");
@@ -563,17 +562,11 @@ main(int argc, char **argv)
                        fprintf(stderr, "rpc.cmsd: fd 0 is not timod\n");
                        exit(1);
                }
-#else  /* !USL || (USL && OSMAJORVERSION > 1) */
-               if (ioctl(0, I_POP, 0) || ioctl(0, I_PUSH, "timod")) {
-                       perror("rpc.cmsd: ioctl I_POP/I_PUSH failed");
-                       exit(1);
-               }
-#endif /* !USL || (USL && OSMAJORVERSION > 1) */
 
        } else if (t_getinfo(0, &info) == 0) {
                standalone = 0;
 
-#endif /* SunOS || USL */
+#endif /* SunOS */
 
        } else
                standalone = 1;
@@ -619,7 +612,7 @@ main(int argc, char **argv)
        signal(SIGHUP, sighup_handler);
 
 
-#if defined(SunOS) || defined(USL) || defined(__uxp__)
+#if defined(SunOS)
        /* raise the soft limit of number of file descriptor */
        /* this is to prevent the backend from running out of open file des */
        getrlimit(RLIMIT_NOFILE, &rl);
@@ -627,7 +620,7 @@ main(int argc, char **argv)
        setrlimit(RLIMIT_NOFILE, &rl);
 #endif
 
-#if defined(SunOS) || defined(USL) || defined(__uxp__)
+#if defined(SunOS)
        nconf_udp = getnetconfigent("udp");
        nconf_tcp = getnetconfigent("tcp");
 
@@ -702,7 +695,7 @@ main(int argc, char **argv)
 
                if (udp_transp == (SVCXPRT *)-1) {
                        udp_transp = svcudp_create(standalone ? RPC_ANYSOCK : 0
-#if defined(_AIX) || defined(hpV4) || defined(__osf__) || defined(linux)
+#if defined(_AIX) || defined(hpV4) || defined(linux) || defined(CSRG_BASED)
                                        );
 #else
                                        ,0,0);
@@ -746,15 +739,19 @@ main(int argc, char **argv)
                }
        }
 
-#endif /* SunOS || USL */
+#endif /* SunOS */
 
 #ifndef AIX
 #ifdef HPUX
        setgid (daemon_gid);
        setuid (daemon_uid);
 #else
-       setegid (daemon_gid);
-       seteuid (daemon_uid);
+       if(-1 == setegid (daemon_gid)) {
+               perror(strerror(errno));
+       }
+       if(-1 == seteuid (daemon_uid)) {
+               perror(strerror(errno));
+       }
 #endif /* HPUX */
 #endif /* AIX */