(** Make a pair of fifo entries *)
-let mkentry fqp abspath perm =
+let mkentry fqp abspath perm uname =
printf "Making entry %s->%s\n" fqp abspath;flush Pervasives.stdout;
let fifoin=sprintf "%s.in" fqp in
let fifoout=sprintf "%s.out" fqp in
(try Unix.unlink fifoin with _ -> ());
(try Unix.unlink fifoout with _ -> ());
(try
- Unix.mkfifo (sprintf "%s.in" fqp) 0o666;
- Unix.mkfifo (sprintf "%s.out" fqp) 0o666;
- Success
+ let infname =(sprintf "%s.in" fqp) in
+ let outfname =(sprintf "%s.out" fqp) in
+ Unix.mkfifo infname 0o666;
+ Unix.mkfifo outfname 0o666;
+ ( (* Make the user the owner of the pipes in a non-chroot environment *)
+ if (!Globals.nochroot) then
+ let pwentry = Unix.getpwnam uname in
+ Unix.chown infname pwentry.pw_uid pwentry.pw_gid;
+ Unix.chown outfname pwentry.pw_uid pwentry.pw_gid
+ );
+ Success
with
e->printf "Error creating FIFO: %s->%s. May be something wrong at the frontend.\n" fqp fifoout;flush Pervasives.stdout;Failed)
let realperm = perm land (lnot 0o111) in
match rp with Relpath(rel) ->
let fqp = String.concat "/" [root_dir;rel] in
- let res = Fifowatcher.mkentry fqp abspath realperm in
+ let res = Fifowatcher.mkentry fqp abspath realperm slice_name in
match res with
| Success ->
Fifowatcher.openentry fqp (abspath,slice_name) realperm
let cmdspeclist =
[
("-backend",Arg.Set_string(Globals.backend), "Backend directory");
- ("-frontend",Arg.Tuple[Arg.String(fun s->cur_dir:=s);Arg.String(fun s->cur_slice:=s;input_file_list:=(!cur_dir,!cur_slice)::!input_file_list)], "frontendN,slicenameN")
+ ("-frontend",Arg.Tuple[Arg.String(fun s->cur_dir:=s);Arg.String(fun s->cur_slice:=s;input_file_list:=(!cur_dir,!cur_slice)::!input_file_list)], "frontendN,slicenameN");
+ ("-nochroot",Arg.Set(Globals.nochroot), "Run in non-chroot environment")
]
let cont = ref true