Skip to content

Commit

Permalink
file_scan: check_file: fix uuid's comparaison for xfs
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Bruyelles <[email protected]>
  • Loading branch information
JackSlateur committed Nov 20, 2023
1 parent 591ee47 commit ebc8c1f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
9 changes: 6 additions & 3 deletions file_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,12 @@ bool check_file(struct dbhandle *db, char *path, struct stat *st, bool parent_ch
if (ret)
return false;

if (!uuid_compare(uuid, locked_fs.uuid)) {
fprintf(stderr, "%s lives on fs %s will we are locked on fs %s\n",
path, uuid, locked_fs.uuid);
if (uuid_compare(uuid, locked_fs.uuid) != 0) {
fprintf(stderr, "%s lives on fs ", path);
debug_print_uuid(stderr, uuid);
fprintf(stderr, " will we are locked on fs ");
debug_print_uuid(stderr, locked_fs.uuid);
fprintf(stderr, ".\n");
return false;
}

Expand Down
7 changes: 7 additions & 0 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,3 +332,10 @@ int increase_limits(void) {
(unsigned long long)new_r.rlim_cur);
return 0;
}

void debug_print_uuid(FILE *stream, uuid_t uuid)
{
char buf[37];
uuid_unparse(uuid, buf);
fprintf(stream, buf);
}
3 changes: 3 additions & 0 deletions util.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <stdint.h>
#include <sys/time.h>
#include <unistd.h>
#include <uuid/uuid.h>

/* controlled by user options, turns pretty print on if true. */
extern int human_readable;
Expand Down Expand Up @@ -77,4 +78,6 @@ static inline void closefd(int *fd)
close(*fd);
}

void debug_print_uuid(FILE *stream, uuid_t uuid);

#endif /* __UTIL_H__ */

0 comments on commit ebc8c1f

Please sign in to comment.