]> code.citadel.org Git - citadel.git/blobdiff - citadel/server_main.c
- pass -Wcast-qual to gcc
[citadel.git] / citadel / server_main.c
index d5a6a8eba5f27f503931b4be8c4071921d0449a1..c7b73329c1dd59659502e25e9912886beb6e8f20 100644 (file)
@@ -70,6 +70,7 @@ int main(int argc, char **argv)
        int drop_root_perms = 1;
        char *moddir;
        struct worker_node *wnp;
+       size_t size;
         
        /* specify default port name and trace file */
        strcpy(tracefile, "");
@@ -170,8 +171,9 @@ int main(int argc, char **argv)
         * Load any server-side modules (plugins) available here.
         */
        lprintf(7, "Initializing loadable modules\n");
-       if ((moddir = malloc(strlen(bbs_home_directory) + 9)) != NULL) {
-               sprintf(moddir, "%s/modules", bbs_home_directory);
+       size = strlen(bbs_home_directory) + 9;
+       if ((moddir = mallok(size)) != NULL) {
+               snprintf(moddir, size, "%s/modules", bbs_home_directory);
                DLoader_Init(moddir);
                free(moddir);
        }
@@ -195,16 +197,16 @@ int main(int argc, char **argv)
         */
        if (drop_root_perms) {
                if ((pw = getpwuid(BBSUID)) == NULL)
-                       lprintf(1, "WARNING: getpwuid(%d): %s\n"
-                                  "Group IDs will be incorrect.\n", BBSUID,
+                       lprintf(1, "WARNING: getpwuid(%ld): %s\n"
+                                  "Group IDs will be incorrect.\n", (long)BBSUID,
                                strerror(errno));
                else {
                        initgroups(pw->pw_name, pw->pw_gid);
                        if (setgid(pw->pw_gid))
-                               lprintf(3, "setgid(%d): %s\n", pw->pw_gid,
+                               lprintf(3, "setgid(%ld): %s\n", (long)pw->pw_gid,
                                        strerror(errno));
                }
-               lprintf(7, "Changing uid to %d\n", BBSUID);
+               lprintf(7, "Changing uid to %ld\n", (long)BBSUID);
                if (setuid(BBSUID) != 0) {
                        lprintf(3, "setuid() failed: %s\n", strerror(errno));
                }