提交 590eaf01 编写于 作者: C cheng_jinsong

fix fstab linker

Signed-off-by: Ncheng_jinsong <chengjinsong2@huawei.com>
上级 5227241f
...@@ -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.
先完成此消息的编辑!
想要评论请 注册