projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove unneeded RCU lock
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
ust-registry.c
diff --git
a/src/bin/lttng-sessiond/ust-registry.c
b/src/bin/lttng-sessiond/ust-registry.c
index 26f306d52d516ac6091e74a1cb26ef73821dbbbd..2ba41ed45dffbb91d272c4561dcf040290f6ed58 100644
(file)
--- a/
src/bin/lttng-sessiond/ust-registry.c
+++ b/
src/bin/lttng-sessiond/ust-registry.c
@@
-547,6
+547,7
@@
int ust_registry_session_init(struct ust_registry_session **sessionp,
int byte_order,
uint32_t major,
uint32_t minor,
int byte_order,
uint32_t major,
uint32_t minor,
+ const char *root_shm_path,
const char *shm_path,
uid_t euid,
gid_t egid)
const char *shm_path,
uid_t euid,
gid_t egid)
@@
-571,6
+572,11
@@
int ust_registry_session_init(struct ust_registry_session **sessionp,
session->long_alignment = long_alignment;
session->byte_order = byte_order;
session->metadata_fd = -1;
session->long_alignment = long_alignment;
session->byte_order = byte_order;
session->metadata_fd = -1;
+ session->uid = euid;
+ session->gid = egid;
+ strncpy(session->root_shm_path, root_shm_path,
+ sizeof(session->root_shm_path));
+ session->root_shm_path[sizeof(session->root_shm_path) - 1] = '\0';
if (shm_path[0]) {
strncpy(session->shm_path, shm_path,
sizeof(session->shm_path));
if (shm_path[0]) {
strncpy(session->shm_path, shm_path,
sizeof(session->shm_path));
@@
-587,16
+593,18
@@
int ust_registry_session_init(struct ust_registry_session **sessionp,
S_IRWXU | S_IRWXG,
euid, egid);
if (ret) {
S_IRWXU | S_IRWXG,
euid, egid);
if (ret) {
+ errno = -ret;
PERROR("run_as_mkdir_recursive");
goto error;
}
}
if (session->metadata_path[0]) {
/* Create metadata file */
PERROR("run_as_mkdir_recursive");
goto error;
}
}
if (session->metadata_path[0]) {
/* Create metadata file */
- ret = open(session->metadata_path,
+ ret =
run_as_
open(session->metadata_path,
O_WRONLY | O_CREAT | O_EXCL,
O_WRONLY | O_CREAT | O_EXCL,
- S_IRUSR | S_IWUSR);
+ S_IRUSR | S_IWUSR
, euid, egid
);
if (ret < 0) {
if (ret < 0) {
+ errno = -ret;
PERROR("Opening metadata file");
goto error;
}
PERROR("Opening metadata file");
goto error;
}
@@
-671,9
+679,17
@@
void ust_registry_session_destroy(struct ust_registry_session *reg)
if (ret) {
PERROR("close");
}
if (ret) {
PERROR("close");
}
- ret = unlink(reg->metadata_path);
+ ret = run_as_unlink(reg->metadata_path,
+ reg->uid, reg->gid);
if (ret) {
PERROR("unlink");
}
}
if (ret) {
PERROR("unlink");
}
}
+ if (reg->root_shm_path[0]) {
+ /*
+ * Try deleting the directory hierarchy.
+ */
+ (void) run_as_recursive_rmdir(reg->root_shm_path,
+ reg->uid, reg->gid);
+ }
}
}
This page took
0.024276 seconds
and
4
git commands to generate.