Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while (1) {
- line = readLine();
- if (line.isNull()) {
- return -1;
- }
- if (line == "display") {
- writeLine(display());
- } else if (line == "display_auth") {
- #if HAVE_X11
- writeLine(displayAuth());
- #else
- writeLine("");
- #endif
- } else if (line == "command") {
- writeString(m_command);
- } else if (line == "path") {
- QByteArray path = qgetenv("PATH");
- if (!path.isEmpty() && path[0] == ':') {
- path = path.mid(1);
- }
- if (m_user == "root") {
- if (!path.isEmpty()) {
- path = "/sbin:/bin:/usr/sbin:/usr/bin:" + path;
- } else {
- path = "/sbin:/bin:/usr/sbin:/usr/bin";
- }
- }
- writeLine(path);
- } else if (line == "user") {
- writeLine(m_user);
- } else if (line == "priority") {
- tmp.setNum(m_priority);
- writeLine(tmp);
- } else if (line == "scheduler") {
- if (m_scheduler == SchedRealtime) {
- writeLine("realtime");
- } else {
- writeLine("normal");
- }
- } else if (line == "xwindows_only") {
- if (m_XOnly) {
- writeLine("no");
- } else {
- writeLine("yes");
- }
- } else if (line == "app_startup_id") {
- QList<QByteArray> env = environment();
- QByteArray tmp;
- for (int i = 0; i < env.count(); ++i) {
- const char startup_env[] = "DESKTOP_STARTUP_ID=";
- if (env.at(i).startsWith(startup_env)) {
- tmp = env.at(i).mid(sizeof(startup_env) - 1);
- }
- }
- if (tmp.isEmpty()) {
- tmp = "0"; // krazy:exclude=doublequote_chars
- }
- writeLine(tmp);
- } else if (line == "app_start_pid") { // obsolete
- // Force the pid_t returned from getpid() into
- // something QByteArray understands; avoids ambiguity
- // between short and unsigned short in particular.
- tmp.setNum((PIDType<sizeof(pid_t)>::PID_t)(getpid()));
- writeLine(tmp);
- } else if (line == "environment") { // additional env vars
- QList<QByteArray> env = environment();
- for (int i = 0; i < env.count(); ++i) {
- writeString(env.at(i));
- }
- writeLine("");
- } else if (line == "end") {
- return 0;
- } else {
- qWarning() << "[" << __FILE__ << ":" << __LINE__ << "] " << "Unknown request:" << line;
- return 1;
- }
- }
- /*
- * !!! ADDED BY ARRAYBOLT3
- * !!! Notice that there's no match for "stop" anywhere in this long list of "else if" statements. I think that's what
- * !!! kdesu is complaining about.
- *
- */
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement