NULL
};
-int mac_smack_use(void) {
- static int cached_use = -1;
+int mac_smack_use(void)
+{
+ static int cached_use = -1;
- if (cached_use < 0)
- cached_use = access("/sys/fs/smackfs/", F_OK) >= 0;
+ if (cached_use < 0)
+ cached_use = access("/sys/fs/smackfs/", F_OK) >= 0;
- return cached_use;
+ return cached_use;
}
static int mount_user_ext(char *username)
int r;
mnt_uid = atoi(username);
- if(mnt_uid <= 0)
+ if (mnt_uid <= 0)
return -1;
r = asprintf(&mount_point, "/run/user_ext/%s", username);
(void) mkdir(mount_point, 0750);
r = getgrnam_r(GRP_NAME_SYSTEM_SHARE, &grp_buf, buf, sizeof(buf), &p_grp);
- if( r == 0 && p_grp != NULL)
- {
+ if (r == 0 && p_grp != NULL) {
mnt_gid = p_grp->gr_gid;
- }
- else
- {
+ } else {
free(mount_point);
return -2;
}
fp = fopen("/proc/self/attr/current", "w");
- if(fp == NULL)
- {
+ if (fp == NULL) {
r = -errno;
return r;
}
r = fputs("User", fp);
- if(r == EOF)
- {
+ if (r == EOF) {
fclose(fp);
r = -errno;
return r;
r = -errno;
} else if (pid == 0) {
r = change_smack_for_user_session();
- if(r != 0)
- {
+ if (r != 0) {
fprintf(stderr, "failed to change smack\n");
return r;
}
operation = argv[1];
username = argv[2];
- if (strcmp(operation,"stop") == 0) {
+ if (strcmp(operation, "stop") == 0)
return stop_process(username);
- } else if (strcmp(operation, "start") == 0) {
- } else {
+ else if (strcmp(operation, "start") == 0)
+ ; /* do main code */
+ else {
fprintf(stderr, "option is invalid(%s)\n", operation);
return -2;
}