[Git][NTPsec/ntpsec][master] 2 commits: SHM: change implicit casts to explicit: (enum segstat_t)

Gary E. Miller gitlab at mg.gitlab.com
Thu Jun 8 23:05:52 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
1776bf69 by Gary E. Miller at 2017-06-08T15:52:00-07:00
SHM: change implicit casts to explicit: (enum segstat_t)

- - - - -
f86603f6 by Gary E. Miller at 2017-06-08T16:03:03-07:00
Sandbox: comment on odd Apple behavior.

For some odd reason initgroups() tkes an int, instead of git_t, for
the second argument.  Even though the 2nd argument is clearly a gid.

Apple makes this work by making gid_t a unit32_t and so an int can
hold it.

- - - - -


2 changed files:

- ntpd/ntp_sandbox.c
- ntpd/refclock_shm.c


Changes:

=====================================
ntpd/ntp_sandbox.c
=====================================
--- a/ntpd/ntp_sandbox.c
+++ b/ntpd/ntp_sandbox.c
@@ -171,6 +171,7 @@ getgroup:
 			exit(-1);
 		}
 #  endif /* HAVE_SOLARIS_PRIVS */
+                /* FIXME? Apple takes an int as 2nd argument */
 		if (user && initgroups(user, (gid_t)sw_gid)) {
 			msyslog(LOG_ERR, "Cannot initgroups() to user `%s': %m", user);
 			exit (-1);


=====================================
ntpd/refclock_shm.c
=====================================
--- a/ntpd/refclock_shm.c
+++ b/ntpd/refclock_shm.c
@@ -363,7 +363,7 @@ static enum segstat_t shm_query(volatile struct shmTime *shm_in, struct shm_stat
      */
     if (shmcopy.mode > 0 && cnt != shm->count) {
 	shm_stat->status = CLASH;
-	return shm_stat->status;
+	return (enum segstat_t)shm_stat->status;
     }
 
     shm_stat->status = OK;
@@ -437,7 +437,7 @@ static enum segstat_t shm_query(volatile struct shmTime *shm_in, struct shm_stat
     shm_stat->leap = shmcopy.leap;
     shm_stat->precision = shmcopy.precision;
 
-    return shm_stat->status;
+    return (enum segstat_t)shm_stat->status;
 }
 
 /*



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/eadb7a970f34ac884692d2b8465bf0b0f56824eb...f86603f6c70632a78e196709fce4c0c6a09ba3cc

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/eadb7a970f34ac884692d2b8465bf0b0f56824eb...f86603f6c70632a78e196709fce4c0c6a09ba3cc
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170608/0db9883d/attachment.html>


More information about the vc mailing list