Corrected an implementation error and added more comments
This commit is contained in:
parent
d6d4af0c8c
commit
1a3f36a92c
|
@ -722,17 +722,15 @@ LinkTable *LinkTable_disk_open(const char *dirn)
|
|||
FREE(metadirn);
|
||||
|
||||
if (!fp) {
|
||||
lprintf(debug, "Linktable at %s does not exist.", path);
|
||||
FREE(path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LinkTable *linktbl = CALLOC(1, sizeof(LinkTable));
|
||||
|
||||
if (sizeof(int) != fread(&linktbl->num, sizeof(int), 1, fp)) {
|
||||
/*
|
||||
* reached EOF
|
||||
*/
|
||||
lprintf(error, "reached EOF!\n");
|
||||
if (fread(&linktbl->num, sizeof(int), 1, fp) != 1) {
|
||||
lprintf(error, "Failed to read the first int of %s!\n", path);
|
||||
LinkTable_free(linktbl);
|
||||
LinkTable_disk_delete(dirn);
|
||||
return NULL;
|
||||
|
|
|
@ -43,6 +43,7 @@ struct LinkTable {
|
|||
struct Link {
|
||||
/** \brief The link name in the last level of the URL */
|
||||
char linkname[MAX_FILENAME_LEN + 1];
|
||||
/** \brief This is for storing the unescaped path */
|
||||
char linkpath[MAX_FILENAME_LEN + 1];
|
||||
/** \brief The full URL of the file */
|
||||
char f_url[MAX_PATH_LEN + 1];
|
||||
|
@ -116,6 +117,7 @@ int LinkTable_disk_save(LinkTable *linktbl, const char *dirn);
|
|||
|
||||
/**
|
||||
* \brief load a link table from the disk.
|
||||
* \param[in] dirn We expected the unescaped_path here!
|
||||
*/
|
||||
LinkTable *LinkTable_disk_open(const char *dirn);
|
||||
|
||||
|
|
Loading…
Reference in New Issue