Anonymous committed c7d1d1b

Use dev_t for device id (st_dev) from stat in setup_git_directory_gently()

The original declaration was int, which seems to cause trouble on my
machine. It causes spurious "filesystem boundary" errors when running
the testsuite. The cause seems to be

$ stat -c%d .

which is too large for a 32-bit int type.

Using the correct type, dev_t, solves the issue. (Because I'm
paranoid and forgetful, I checked -- yes, Unix v7 had dev_t.)

Other uses of st_dev seem to be reasonably safe. fill_stat_cache_info
truncates it to an 'unsigned int', but that value seems to be used only
to validate the cache, and only if USE_STDEV is defined.

Signed-off-by: Raja R Harinath <>
Signed-off-by: Junio C Hamano <>

Comments (0)

Files changed (1)

 	const char *gitdirenv;
 	const char *gitfile_dir;
 	int len, offset, ceil_offset, root_len;
-	int current_device = 0, one_filesystem = 1;
+	dev_t current_device = 0;
+	int one_filesystem = 1;
 	struct stat buf;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.