core-agent-linux: misc const fixups

This commit is contained in:
Vincent Penquerc'h 2013-12-28 06:49:30 -05:00 committed by Marek Marczykowski-Górecki
parent 4a4e81f010
commit 475421b2e2
3 changed files with 8 additions and 8 deletions

View File

@ -112,14 +112,14 @@ void no_colon_in_cmd()
exit(1);
}
void do_exec(char *cmd)
void do_exec(const char *cmd)
{
char buf[strlen(QUBES_RPC_MULTIPLEXER_PATH) + strlen(cmd) - strlen(QUBES_RPC_MAGIC_CMD) + 1];
char *realcmd = index(cmd, ':');
char *realcmd = index(cmd, ':'), *user;
if (!realcmd)
no_colon_in_cmd();
/* mark end of username and move to command */
*realcmd = 0;
user=strndup(cmd,realcmd-cmd);
realcmd++;
/* ignore "nogui:" prefix in linux agent */
if (strncmp(realcmd, "nogui:", 6) == 0)
@ -133,7 +133,7 @@ void do_exec(char *cmd)
signal(SIGCHLD, SIG_DFL);
signal(SIGPIPE, SIG_DFL);
execl("/bin/su", "su", "-", cmd, "-c", realcmd, NULL);
execl("/bin/su", "su", "-", user, "-c", realcmd, NULL);
perror("execl");
exit(1);
}

View File

@ -25,7 +25,7 @@
#include <fcntl.h>
#include <errno.h>
void perror_wrapper(char * msg)
void perror_wrapper(const char * msg)
{
int prev=errno;
perror(msg);
@ -48,7 +48,7 @@ void set_block(int fd)
fcntl(fd, F_SETFL, fl & ~O_NONBLOCK);
}
int write_all(int fd, void *buf, int size)
int write_all(int fd, const void *buf, int size)
{
int written = 0;
int ret;

View File

@ -12,7 +12,7 @@
#include <errno.h>
#include <libqubes-rpc-filecopy.h>
#define INCOMING_DIR_ROOT "/home/user/QubesIncoming"
int prepare_creds_return_uid(char *username)
int prepare_creds_return_uid(const char *username)
{
struct passwd *pwd;
pwd = getpwnam(username);
@ -37,7 +37,7 @@ int main(int argc, char ** argv)
{
char *incoming_dir;
int uid;
char *remote_domain;
const char *remote_domain;
uid = prepare_creds_return_uid("user");