diff options
Diffstat (limited to 'apps/tagcache.c')
-rw-r--r-- | apps/tagcache.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c index a297bc7353..a66f9658ae 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -423,11 +423,13 @@ static int open_tag_fd(struct tagcache_header *hdr, int tag, bool write) | |||
423 | { | 423 | { |
424 | int fd; | 424 | int fd; |
425 | int rc; | 425 | int rc; |
426 | char fname[MAX_PATH]; | ||
426 | 427 | ||
427 | if (TAGCACHE_IS_NUMERIC(tag) || tag < 0 || tag >= TAG_COUNT) | 428 | if (TAGCACHE_IS_NUMERIC(tag) || tag < 0 || tag >= TAG_COUNT) |
428 | return -1; | 429 | return -1; |
429 | 430 | ||
430 | fd = open_pathfmt(write ? O_RDWR : O_RDONLY, TAGCACHE_FILE_INDEX, tag); | 431 | fd = open_pathfmt(fname, sizeof(fname), |
432 | write ? O_RDWR : O_RDONLY, TAGCACHE_FILE_INDEX, tag); | ||
431 | 433 | ||
432 | if (fd < 0) | 434 | if (fd < 0) |
433 | { | 435 | { |
@@ -803,7 +805,9 @@ static bool open_files(struct tagcache_search *tcs, int tag) | |||
803 | { | 805 | { |
804 | if (tcs->idxfd[tag] < 0) | 806 | if (tcs->idxfd[tag] < 0) |
805 | { | 807 | { |
806 | tcs->idxfd[tag] = open_pathfmt(O_RDONLY, TAGCACHE_FILE_INDEX, tag); | 808 | char fname[MAX_PATH]; |
809 | tcs->idxfd[tag] = open_pathfmt(fname, sizeof(fname), | ||
810 | O_RDONLY, TAGCACHE_FILE_INDEX, tag); | ||
807 | } | 811 | } |
808 | 812 | ||
809 | if (tcs->idxfd[tag] < 0) | 813 | if (tcs->idxfd[tag] < 0) |
@@ -1583,9 +1587,10 @@ bool tagcache_search_add_clause(struct tagcache_search *tcs, | |||
1583 | } | 1587 | } |
1584 | 1588 | ||
1585 | if (!TAGCACHE_IS_NUMERIC(clause->tag) && tcs->idxfd[clause->tag] < 0) | 1589 | if (!TAGCACHE_IS_NUMERIC(clause->tag) && tcs->idxfd[clause->tag] < 0) |
1586 | { | 1590 | { |
1587 | tcs->idxfd[clause->tag] = open_pathfmt(O_RDONLY, | 1591 | char fname[MAX_PATH]; |
1588 | TAGCACHE_FILE_INDEX, clause->tag); | 1592 | tcs->idxfd[clause->tag] = open_pathfmt(fname, sizeof(fname), O_RDONLY, |
1593 | TAGCACHE_FILE_INDEX, clause->tag); | ||
1589 | } | 1594 | } |
1590 | } | 1595 | } |
1591 | 1596 | ||
@@ -2743,7 +2748,7 @@ static int build_index(int index_type, struct tagcache_header *h, int tmpfd) | |||
2743 | * Creating new index file to store the tags. No need to preload | 2748 | * Creating new index file to store the tags. No need to preload |
2744 | * anything whether the index type is sorted or not. | 2749 | * anything whether the index type is sorted or not. |
2745 | */ | 2750 | */ |
2746 | fd = open_pathfmt(O_WRONLY | O_CREAT | O_TRUNC, | 2751 | fd = open_pathfmt(buf, bufsz, O_WRONLY | O_CREAT | O_TRUNC, |
2747 | TAGCACHE_FILE_INDEX, index_type); | 2752 | TAGCACHE_FILE_INDEX, index_type); |
2748 | if (fd < 0) | 2753 | if (fd < 0) |
2749 | { | 2754 | { |
@@ -4401,7 +4406,7 @@ static bool check_deleted_files(void) | |||
4401 | 4406 | ||
4402 | logf("reverse scan..."); | 4407 | logf("reverse scan..."); |
4403 | 4408 | ||
4404 | fd = open_pathfmt(O_RDONLY, TAGCACHE_FILE_INDEX, tag_filename); | 4409 | fd = open_pathfmt(buf, bufsz, O_RDONLY, TAGCACHE_FILE_INDEX, tag_filename); |
4405 | if (fd < 0) | 4410 | if (fd < 0) |
4406 | { | 4411 | { |
4407 | logf(TAGCACHE_FILE_INDEX " open fail", tag_filename); | 4412 | logf(TAGCACHE_FILE_INDEX " open fail", tag_filename); |