Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 148519 | Differences between
and this patch

Collapse All | Expand All

(-)ionice.c.ori (-5 / +10 lines)
Lines 1-5 Link Here
1
2
3
#include <stdio.h>
1
#include <stdio.h>
4
#include <stdlib.h>
2
#include <stdlib.h>
5
#include <errno.h>
3
#include <errno.h>
Lines 99-114 Link Here
99
			printf("%s: prio %d\n", to_prio[ioprio_class], ioprio);
97
			printf("%s: prio %d\n", to_prio[ioprio_class], ioprio);
100
		}
98
		}
101
	} else {
99
	} else {
100
		if (getuid()!=0 && (ioprio_class < IOPRIO_CLASS_BE || ioprio < 4) ) {
101
			fprintf(stderr, "User cannot set higher ioprio\n");
102
			return 1;
103
		}
102
		if (ioprio_set(IOPRIO_WHO_PROCESS, pid, ioprio | ioprio_class << IOPRIO_CLASS_SHIFT) == -1) {
104
		if (ioprio_set(IOPRIO_WHO_PROCESS, pid, ioprio | ioprio_class << IOPRIO_CLASS_SHIFT) == -1) {
103
			perror("ioprio_set");
105
			perror("ioprio_set");
104
			return 1;
106
			return 1;
105
		}
107
		}
106
108
107
		if (argv[optind])
109
		if (argv[optind]) {
110
			if (seteuid(getuid())!=0 || setegid(getgid())!=0) {
111
				perror("Error setting real user");
112
				return 1;
113
			}
108
			execvp(argv[optind], &argv[optind]);
114
			execvp(argv[optind], &argv[optind]);
115
		}
109
	}
116
	}
110
117
111
	return 0;
118
	return 0;
112
}
119
}
113
114

Return to bug 148519