dtcm: Resolve CID 87822
[oweals/cde.git] / cde / programs / dtcm / server / rtable4.c
index 3eea3cb17bf2ae4c812f0ef520552f16765271a2..4fdf17e12573f91d61c5bf9214d86bc89ff827d7 100644 (file)
@@ -1,3 +1,25 @@
+/*
+ * CDE - Common Desktop Environment
+ *
+ * Copyright (c) 1993-2012, The Open Group. All rights reserved.
+ *
+ * These libraries and programs are free software; you can
+ * redistribute them and/or modify them under the terms of the GNU
+ * Lesser General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * These libraries and programs are distributed in the hope that
+ * they will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with these librararies and programs; if not, write
+ * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301 USA
+ */
 /* $XConsortium: rtable4.c /main/5 1996/10/02 17:31:51 drk $ */
 /*
  *  (c) Copyright 1993, 1994 Hewlett-Packard Company
 #include <sys/time.h>
 #include <sys/signal.h>
 #include <rpc/rpc.h>
+#if defined(CSRG_BASED)
+#define MAXINT INT_MAX
+#else
 #include <values.h>
+#endif
 #include <string.h>
 #include <pwd.h>
 #ifdef SUNOS
@@ -1384,12 +1410,21 @@ extern long *
 _DtCm_rtable_gmtoff_4_svc(void *args, struct svc_req *svcrq)
 {
        static long gmtoff;
+#if !defined(CSRG_BASED)
        extern long timezone;
+#else
+       struct tm *t;
+#endif
 
        if (debug)
                fprintf(stderr, "_DtCm_rtable_gmtoff_4_svc called\n");
 
+#if defined(CSRG_BASED)
+       t = localtime(time(NULL));
+       gmtoff = t->tm_gmtoff;
+#else
        gmtoff = timezone;
+#endif
        return(&gmtoff);
 }
 
@@ -1519,12 +1554,10 @@ _DtCm_rtable_rename_4_svc(Table_Op_Args_4 *args, struct svc_req *svcrq)
 extern void *
 _DtCm_rtable_ping_4_svc(void *args, struct svc_req *svcrq)
 {
-       char dummy;
-
        if (debug)
                fprintf(stderr, "_DtCm_rtable_ping_4_svc called\n");
 
-       return((void *)&dummy); /* for RPC reply */
+       return(NULL); /* for RPC reply */
 }
 
 extern void