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