mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-06 02:54:40 +00:00
use lxc_mmap() and lxc_munmap()
Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
This commit is contained in:
parent
1adbd02064
commit
aeea34d709
@ -2163,13 +2163,8 @@ static bool mod_rdep(struct lxc_container *c0, struct lxc_container *c, bool inc
|
||||
}
|
||||
|
||||
if (fbuf.st_size != 0) {
|
||||
/* write terminating \0-byte to file */
|
||||
if (pwrite(fd, "", 1, fbuf.st_size) <= 0) {
|
||||
close(fd);
|
||||
goto out;
|
||||
}
|
||||
|
||||
buf = mmap(NULL, fbuf.st_size + 1, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
buf = lxc_mmap(NULL, fbuf.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
if (buf == MAP_FAILED) {
|
||||
SYSERROR("Failed to create mapping %s", path);
|
||||
close(fd);
|
||||
@ -2182,7 +2177,7 @@ static bool mod_rdep(struct lxc_container *c0, struct lxc_container *c, bool inc
|
||||
bytes += len;
|
||||
}
|
||||
|
||||
munmap(buf, fbuf.st_size + 1);
|
||||
lxc_munmap(buf, fbuf.st_size);
|
||||
if (ftruncate(fd, fbuf.st_size - bytes) < 0) {
|
||||
SYSERROR("Failed to truncate file %s", path);
|
||||
close(fd);
|
||||
|
Loading…
Reference in New Issue
Block a user