s3-printing: Correctly create the printing cache path.
authorAndreas Schneider <asn@samba.org>
Mon, 10 Dec 2012 16:52:50 +0000 (17:52 +0100)
committerGünther Deschner <gd@samba.org>
Wed, 12 Dec 2012 14:00:02 +0000 (15:00 +0100)
Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
source3/printing/printing.c

index e0d6179c021805896b1403f315608e90029d18a6..c394118303aeea06cd9dac92ea482dce204d845f 100644 (file)
@@ -197,13 +197,18 @@ bool print_backend_init(struct messaging_context *msg_ctx)
        const char *sversion = "INFO/version";
        int services = lp_numservices();
        int snum;
+       bool ok;
 
        if (!printer_list_parent_init()) {
                return false;
        }
 
+       ok = directory_create_or_exist(cache_path("printing"), geteuid(), 0755);
+       if (!ok) {
+               return false;
+       }
+
        unlink(cache_path("printing.tdb"));
-       mkdir(cache_path("printing"),0755);
 
        /* handle a Samba upgrade */