projects
/
GitHub
/
LineageOS
/
android_kernel_samsung_universal7580.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
643bb09
)
scripts: recordmcount: break hardlinks
author
Russell King
<rmk+kernel@arm.linux.org.uk>
Fri, 11 Dec 2015 12:09:03 +0000
(12:09 +0000)
committer
Danny Wood
<danwood76@gmail.com>
Tue, 29 Jan 2019 13:12:04 +0000
(13:12 +0000)
commit
dd39a26538e37f6c6131e829a4a510787e43c783
upstream.
recordmcount edits the file in-place, which can cause problems when
using ccache in hardlink mode. Arrange for recordmcount to break a
hardlinked object.
Link:
http://lkml.kernel.org/r/E1a7MVT-0000et-62@rmk-PC.arm.linux.org.uk
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
scripts/recordmcount.c
patch
|
blob
|
blame
|
history
diff --git
a/scripts/recordmcount.c
b/scripts/recordmcount.c
index e11aa4a156d2d26df48706d0da0a7970813e9798..6faf6c654e8f32d39803e7c379e44e780168aebd 100644
(file)
--- a/
scripts/recordmcount.c
+++ b/
scripts/recordmcount.c
@@
-194,6
+194,20
@@
static void *mmap_file(char const *fname)
addr = umalloc(sb.st_size);
uread(fd_map, addr, sb.st_size);
}
+ if (sb.st_nlink != 1) {
+ /* file is hard-linked, break the hard link */
+ close(fd_map);
+ if (unlink(fname) < 0) {
+ perror(fname);
+ fail_file();
+ }
+ fd_map = open(fname, O_RDWR | O_CREAT, sb.st_mode);
+ if (fd_map < 0) {
+ perror(fname);
+ fail_file();
+ }
+ uwrite(fd_map, addr, sb.st_size);
+ }
return addr;
}