]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/cups-deviced.c
Import CUPS v2.0b1
[thirdparty/cups.git] / scheduler / cups-deviced.c
index 80fc7da1b4a2c4bcd23faf7060b9f2d64a74a2fb..85264ed878f0f422fae0747073139811892d92e9 100644 (file)
@@ -1,27 +1,16 @@
 /*
- * "$Id: cups-deviced.c 10996 2013-05-29 11:51:34Z msweet $"
+ * "$Id: cups-deviced.c 11782 2014-03-28 21:03:43Z msweet $"
  *
- *   Device scanning mini-daemon for CUPS.
+ * Device scanning mini-daemon for CUPS.
  *
- *   Copyright 2007-2011 by Apple Inc.
- *   Copyright 1997-2006 by Easy Software Products.
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1997-2006 by Easy Software Products.
  *
- *   These coded instructions, statements, and computer programs are the
- *   property of Apple Inc. and are protected by Federal copyright
- *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
- *   which should have been included with this file.  If this file is
- *   file is missing or damaged, see the license at "http://www.cups.org/".
- *
- * Contents:
- *
- *   main()                 - Scan for devices and return an IPP response.
- *   add_device()           - Add a new device to the list.
- *   compare_devices()      - Compare device names to eliminate duplicates.
- *   get_current_time()     - Get the current time as a double value in seconds.
- *   get_device()           - Get a device from a backend.
- *   process_children()     - Process all dead children...
- *   sigchld_handler()      - Handle 'child' signals from old processes.
- *   start_backend()        - Run a backend to gather the available devices.
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file.  If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
  */
 
 /*
@@ -82,7 +71,7 @@ static cupsd_backend_t        backends[MAX_BACKENDS];
 static struct pollfd   backend_fds[MAX_BACKENDS];
                                        /* Array for poll() */
 static cups_array_t    *devices;       /* Array of devices */
-static int             normal_user;    /* Normal user ID */
+static uid_t           normal_user;    /* Normal user ID */
 static int             device_limit;   /* Maximum number of devices */
 static int             send_class,     /* Send device-class attribute? */
                        send_info,      /* Send device-info attribute? */
@@ -182,7 +171,7 @@ main(int  argc,                             /* I - Number of command-line args */
     return (1);
   }
 
-  normal_user = atoi(argv[4]);
+  normal_user = (uid_t)atoi(argv[4]);
   if (normal_user <= 0)
   {
     fprintf(stderr, "ERROR: [cups-deviced] Bad user %d!\n", normal_user);
@@ -281,8 +270,7 @@ main(int  argc,                             /* I - Number of command-line args */
     * all others run as the unprivileged user...
     */
 
-    start_backend(dent->filename,
-                  !(dent->fileinfo.st_mode & (S_IRWXG | S_IRWXO)));
+    start_backend(dent->filename, !(dent->fileinfo.st_mode & (S_IWGRP | S_IRWXO)));
   }
 
   cupsDirClose(dir);
@@ -309,7 +297,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
     timeout = (int)(1000 * (end_time - current_time));
 
-    if (poll(backend_fds, num_backends, timeout) > 0)
+    if (poll(backend_fds, (nfds_t)num_backends, timeout) > 0)
     {
       for (i = 0; i < num_backends; i ++)
         if (backend_fds[i].revents && backends[i].pipe)
@@ -326,8 +314,7 @@ main(int  argc,                             /* I - Number of command-line args */
              break;
            }
          }
-         while (bpipe->ptr &&
-                memchr(bpipe->ptr, '\n', bpipe->end - bpipe->ptr));
+         while (bpipe->ptr && memchr(bpipe->ptr, '\n', (size_t)(bpipe->end - bpipe->ptr)));
         }
     }
 
@@ -806,5 +793,5 @@ start_backend(const char *name,             /* I - Backend to run */
 
 
 /*
- * End of "$Id: cups-deviced.c 10996 2013-05-29 11:51:34Z msweet $".
+ * End of "$Id: cups-deviced.c 11782 2014-03-28 21:03:43Z msweet $".
  */