diff options
| author | Philippe Reynes <[email protected]> | 2020-12-23 15:33:07 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2021-01-04 09:10:17 -0500 |
| commit | 1639988fa4c0049e6580dc781fe9bb2c94258c02 (patch) | |
| tree | d8dc9240725505a2b34134629d098f1f9f6da672 /cmd | |
| parent | 19408a397cc634672a405f6235f65a718fc8e14c (diff) | |
cmd: ubi: don't allow to rename a volume to a name that already exist
This commits add a check on the command ubi rename. This check avoids
to rename a volume to with a name that is already used on another ubi
volume. If two volumes has the same name, then the ubi device can't be
mounted anymore.
Signed-off-by: Philippe Reynes <[email protected]>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/ubi.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd/ubi.c b/cmd/ubi.c index 171377cc66b..cb14e3e1e79 100644 --- a/cmd/ubi.c +++ b/cmd/ubi.c @@ -264,6 +264,11 @@ static int ubi_rename_vol(char *oldname, char *newname) return ENODEV; } + if (!ubi_check(newname)) { + printf("%s: volume %s already exist\n", __func__, newname); + return EINVAL; + } + printf("Rename UBI volume %s to %s\n", oldname, newname); if (ubi->ro_mode) { |
