Fix issue: https://gitee.com/src-openeuler/cifs-utils/issues/I6RRNJ Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com> (cherry picked from commit 9305c08964d0f21e12f29fed187e53e5231770a2)
52 lines
1.5 KiB
Diff
52 lines
1.5 KiB
Diff
From 8f46aaadffde42ef0c89e97c0443ee7944708d94 Mon Sep 17 00:00:00 2001
|
|
From: Simon Arlott <simon@octiron.net>
|
|
Date: Thu, 26 Nov 2020 00:28:08 +0000
|
|
Subject: [PATCH] Add missing position handling to mount parameters
|
|
gid/backup_gid/snapshot
|
|
|
|
The code tries to optimise for the last parameter not needing to update
|
|
the position which means that every time a new one is added to the end
|
|
by copying and pasting, the string position is not updated.
|
|
|
|
That makes it impossible to use backup_uid=/backup_gid=/snapshot= after
|
|
gid= or snapshot= after backup_gid= because part of the string is
|
|
overwritten and contains invalid keys like "gbackup_uid".
|
|
|
|
Prepare for the next parameter to be added on the end by updating the
|
|
position for snapshot= even though it will be unused.
|
|
---
|
|
mount.cifs.c | 3 +++
|
|
1 file changed, 3 insertions(+)
|
|
|
|
diff --git a/mount.cifs.c b/mount.cifs.c
|
|
index 2474e98..ff07232 100644
|
|
--- a/mount.cifs.c
|
|
+++ b/mount.cifs.c
|
|
@@ -1245,6 +1245,7 @@ nocopy:
|
|
out_len++;
|
|
}
|
|
snprintf(out + out_len, word_len + 5, "gid=%s", txtbuf);
|
|
+ out_len = strlen(out);
|
|
}
|
|
if (got_bkupuid) {
|
|
word_len = snprintf(txtbuf, sizeof(txtbuf), "%u", bkupuid);
|
|
@@ -1276,6 +1277,7 @@ nocopy:
|
|
out_len++;
|
|
}
|
|
snprintf(out + out_len, word_len + 11, "backupgid=%s", txtbuf);
|
|
+ out_len = strlen(out);
|
|
}
|
|
if (got_snapshot) {
|
|
word_len = snprintf(txtbuf, sizeof(txtbuf), "%llu", snapshot);
|
|
@@ -1291,6 +1293,7 @@ nocopy:
|
|
out_len++;
|
|
}
|
|
snprintf(out + out_len, word_len + 11, "snapshot=%s", txtbuf);
|
|
+ out_len = strlen(out);
|
|
}
|
|
|
|
return 0;
|
|
--
|
|
2.33.0
|
|
|