files: make convert_path_from_another_mp always return relative path

Submitted by Pavel Tikhomirov on Dec. 15, 2017, 11:33 a.m.

Details

Message ID 20171215113304.15617-1-ptikhomirov@virtuozzo.com
State Accepted
Series "files: make convert_path_from_another_mp always return relative path"
Commit 41cdad6c2d69ece4b9c359db3c6b021f2570d37c
Headers show

Commit Message

Pavel Tikhomirov Dec. 15, 2017, 11:33 a.m.
If dmi->ns_mountpoint is "/" then in dst we will return "/..." -
absolute path but we want here path relative to dmi mount. Adding "./"
before the path guaranties that it will be always relative.

https://jira.sw.ru/browse/PSBM-72351
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 criu/files-reg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/files-reg.c b/criu/files-reg.c
index 07b0bc4e5..3a0d6e2c0 100644
--- a/criu/files-reg.c
+++ b/criu/files-reg.c
@@ -1383,7 +1383,7 @@  static void convert_path_from_another_mp(char *src, char *dst, int dlen,
 	 * Absolute path to the mount point + difference between source
 	 * and destination roots + path relative to the mountpoint.
 	 */
-	snprintf(dst, dlen, "%s/%s/%s",
+	snprintf(dst, dlen, "./%s/%s/%s",
 				dmi->ns_mountpoint + 1,
 				smi->root + strlen(dmi->root),
 				src + off);