goto end;
}
+ /*
+ * No need to use run_as API here because whatever we receives, the relayd
+ * uses its own credentials for the stream files.
+ */
ret = utils_create_stream_file(stream->path_name, stream->channel_name,
- stream->tracefile_size, 0, getuid(), getgid());
+ stream->tracefile_size, 0, -1, -1);
if (ret < 0) {
ERR("Create output file");
goto end;
stream->tracefile_size) {
ret = utils_rotate_stream_file(stream->path_name,
stream->channel_name, stream->tracefile_size,
- stream->tracefile_count, getuid(), getgid(),
+ stream->tracefile_count, -1, -1,
stream->fd, &(stream->tracefile_count_current));
if (ret < 0) {
ERR("Rotating output file");
int utils_create_stream_file(char *path_name, char *file_name, uint64_t size,
uint64_t count, int uid, int gid)
{
- int ret, out_fd;
+ int ret, out_fd, flags, mode;
char full_path[PATH_MAX], *path_name_id = NULL, *path;
assert(path_name);
path = full_path;
}
+ flags = O_WRONLY | O_CREAT | O_TRUNC;
/* Open with 660 mode */
- out_fd = run_as_open(path, O_WRONLY | O_CREAT | O_TRUNC,
- S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, uid, gid);
+ mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
+
+ if (uid < 0 || gid < 0) {
+ out_fd = open(path, flags, mode);
+ } else {
+ out_fd = run_as_open(path, flags, mode, uid, gid);
+ }
if (out_fd < 0) {
PERROR("open stream path %s", path);
goto error_open;