bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2010-2018 Dovecot authors, see the included COPYING file */
c33d3f93abf8392fdc60e12bea41ffd12cc85a8dTimo Sirainenint fs_sis_path_parse(struct fs *fs, const char *path,
c33d3f93abf8392fdc60e12bea41ffd12cc85a8dTimo Sirainen /* assume filename begins with "<hash>-" */
c59b9c273b41f7bcf51f6803110b67813879ff05Timo Sirainenvoid fs_sis_try_unlink_hash_file(struct fs *sis_fs, struct fs_file *super_file)
c59b9c273b41f7bcf51f6803110b67813879ff05Timo Sirainen if (fs_sis_path_parse(sis_fs, super_file->path, &dir, &hash) == 0 &&
c59b9c273b41f7bcf51f6803110b67813879ff05Timo Sirainen fs_stat(super_file, &st1) == 0 && st1.st_nlink == 2) {
c33d3f93abf8392fdc60e12bea41ffd12cc85a8dTimo Sirainen /* this may be the last link. if hashes/ file is the same,
c33d3f93abf8392fdc60e12bea41ffd12cc85a8dTimo Sirainen delete it. */
c33d3f93abf8392fdc60e12bea41ffd12cc85a8dTimo Sirainen hash_path = t_strdup_printf("%s/"HASH_DIR_NAME"/%s", dir, hash);