comparison src/permissions.c @ 262:fc1c6425c024

s/EXIT_SUCCESS/0/ && s/EXIT_FAILURE/1/ The constants are all to bulky. We should have different, meaningful exit codes anyway.
author markus schnalke <meillo@marmaro.de>
date Thu, 02 Dec 2010 17:11:25 -0300
parents 996b53a50f55
children 41958685480d
comparison
equal deleted inserted replaced
261:0afe18a9ee03 262:fc1c6425c024
73 73
74 seteuid(0); 74 seteuid(0);
75 75
76 if (setegid(gid) != 0) { 76 if (setegid(gid) != 0) {
77 logwrite(LOG_ALERT, "could not change gid to %d: %s\n", gid, strerror(errno)); 77 logwrite(LOG_ALERT, "could not change gid to %d: %s\n", gid, strerror(errno));
78 exit(EXIT_FAILURE); 78 exit(1);
79 } 79 }
80 if (seteuid(uid) != 0) { 80 if (seteuid(uid) != 0) {
81 logwrite(LOG_ALERT, "could not change uid to %d: %s\n", uid, strerror(errno)); 81 logwrite(LOG_ALERT, "could not change uid to %d: %s\n", uid, strerror(errno));
82 exit(EXIT_FAILURE); 82 exit(1);
83 } 83 }
84 } 84 }
85 85
86 void 86 void
87 set_identity(uid_t old_uid, gchar * task_name) 87 set_identity(uid_t old_uid, gchar * task_name)
88 { 88 {
89 if (!conf.run_as_user) { 89 if (!conf.run_as_user) {
90 if (!is_privileged_user(old_uid)) { 90 if (!is_privileged_user(old_uid)) {
91 fprintf(stderr, "must be root, %s or in group %s for %s.\n", DEF_MAIL_USER, DEF_MAIL_GROUP, task_name); 91 fprintf(stderr, "must be root, %s or in group %s for %s.\n", DEF_MAIL_USER, DEF_MAIL_GROUP, task_name);
92 exit(EXIT_FAILURE); 92 exit(1);
93 } 93 }
94 94
95 set_euidgid(conf.mail_uid, conf.mail_gid, NULL, NULL); 95 set_euidgid(conf.mail_uid, conf.mail_gid, NULL, NULL);
96 } 96 }
97 } 97 }