]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/select.c
The scheduler did not use the ConfigFilePerm setting when copying PPD files or
[thirdparty/cups.git] / scheduler / select.c
index 63e6dc068d2e4bbad7a2815ea953b6be3bf3dbd5..d302db0af8e7459b4b4cfa704225ca94f4f53822 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Select abstraction functions for the CUPS scheduler.
  *
- * Copyright 2007-2013 by Apple Inc.
+ * Copyright 2007-2014 by Apple Inc.
  * Copyright 2006-2007 by Easy Software Products.
  *
  * These coded instructions, statements, and computer programs are the
@@ -518,15 +518,13 @@ cupsdDoSelect(long timeout)               /* I - Timeout in seconds */
 
 
       if (cupsd_pollfds)
-       pfd = realloc(cupsd_pollfds, allocfds * sizeof(struct pollfd));
+       pfd = realloc(cupsd_pollfds, (size_t)allocfds * sizeof(struct pollfd));
       else
-       pfd = malloc(allocfds * sizeof(struct pollfd));
+       pfd = malloc((size_t)allocfds * sizeof(struct pollfd));
 
       if (!pfd)
       {
-       cupsdLogMessage(CUPSD_LOG_EMERG,
-                       "Unable to allocate %d bytes for polling!",
-                       (int)(allocfds * sizeof(struct pollfd)));
+       cupsdLogMessage(CUPSD_LOG_EMERG, "Unable to allocate %d bytes for polling.", (int)((size_t)allocfds * sizeof(struct pollfd)));
 
        return (-1);
       }
@@ -555,9 +553,9 @@ cupsdDoSelect(long timeout)         /* I - Timeout in seconds */
   }
 
   if (timeout >= 0 && timeout < 86400)
-    nfds = poll(cupsd_pollfds, count, timeout * 1000);
+    nfds = poll(cupsd_pollfds, (nfds_t)count, timeout * 1000);
   else
-    nfds = poll(cupsd_pollfds, count, -1);
+    nfds = poll(cupsd_pollfds, (nfds_t)count, -1);
 
   if (nfds > 0)
   {
@@ -808,13 +806,13 @@ cupsdStartSelect(void)
 
 #ifdef HAVE_EPOLL
   cupsd_epoll_fd       = epoll_create(MaxFDs);
-  cupsd_epoll_events   = calloc(MaxFDs, sizeof(struct epoll_event));
+  cupsd_epoll_events   = calloc((size_t)MaxFDs, sizeof(struct epoll_event));
   cupsd_update_pollfds = 0;
 
 #elif defined(HAVE_KQUEUE)
   cupsd_kqueue_fd      = kqueue();
   cupsd_kqueue_changes = 0;
-  cupsd_kqueue_events  = calloc(MaxFDs, sizeof(struct kevent));
+  cupsd_kqueue_events  = calloc((size_t)MaxFDs, sizeof(struct kevent));
 
 #elif defined(HAVE_POLL)
   cupsd_update_pollfds = 0;