未验证 提交 0e23bcb3 编写于 作者: O openharmony_ci 提交者: Gitee

!1903 Fix:修改fstab链表遍历顺序

Merge pull request !1903 from cheng_jinsong/init_0418
...@@ -78,11 +78,11 @@ static int AddToFstab(Fstab *fstab, FstabItem *item) ...@@ -78,11 +78,11 @@ static int AddToFstab(Fstab *fstab, FstabItem *item)
if (fstab == NULL || item == NULL) { if (fstab == NULL || item == NULL) {
return -1; return -1;
} }
if (fstab->head != NULL) { if (fstab->tail == NULL) {
item->next = fstab->head->next; fstab->head = fstab->tail = item;
fstab->head->next = item;
} else { } else {
fstab->head = item; fstab->tail->next = item;
fstab->tail = item;
} }
return 0; return 0;
} }
...@@ -123,6 +123,7 @@ void ReleaseFstab(Fstab *fstab) ...@@ -123,6 +123,7 @@ void ReleaseFstab(Fstab *fstab)
ReleaseFstabItem(item); ReleaseFstabItem(item);
item = tmp; item = tmp;
} }
fstab->head = fstab->tail = NULL;
free(fstab); free(fstab);
fstab = NULL; fstab = NULL;
} }
......
...@@ -59,6 +59,7 @@ typedef struct FstabItem { ...@@ -59,6 +59,7 @@ typedef struct FstabItem {
typedef struct { typedef struct {
struct FstabItem *head; struct FstabItem *head;
struct FstabItem *tail;
} Fstab; } Fstab;
typedef enum SlotFlag { typedef enum SlotFlag {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册