Trim dev name

This commit is contained in:
vvb2060
2019-02-26 16:04:17 +08:00
committed by John Wu
parent 7b089b888a
commit f152bea8d8
3 changed files with 10 additions and 1 deletions

View File

@ -205,7 +205,7 @@ static bool read_fstab_dt(const struct cmdline *cmd, const char *mnt_point, char
if ((fd = xopen(buf, O_RDONLY | O_CLOEXEC)) >= 0) {
read(fd, buf, sizeof(buf));
close(fd);
char *name = strrchr(buf, '/') + 1;
char *name = rtrim(strrchr(buf, '/') + 1);
sprintf(partname, "%s%s", name, strend(name, cmd->slot) ? cmd->slot : "");
sprintf(buf, "%s/fstab/%s/type", cmd->dt_dir, mnt_point);
if ((fd = xopen(buf, O_RDONLY | O_CLOEXEC)) >= 0) {