aboutsummaryrefslogtreecommitdiffstats
path: root/tools/fix_elf
diff options
context:
space:
mode:
authorMikhail Borisov <borisov.mikhail@gmail.com>2022-02-10 16:45:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:39 +0300
commita6a92afe03e02795227d2641b49819b687f088f8 (patch)
treef6984a1d27d5a7ec88a6fdd6e20cd5b7693b6ece /tools/fix_elf
parentc6dc8b8bd530985bc4cce0137e9a5de32f1087cb (diff)
downloadydb-a6a92afe03e02795227d2641b49819b687f088f8.tar.gz
Restoring authorship annotation for Mikhail Borisov <borisov.mikhail@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'tools/fix_elf')
-rw-r--r--tools/fix_elf/patch.cpp64
-rw-r--r--tools/fix_elf/patch.h2
2 files changed, 33 insertions, 33 deletions
diff --git a/tools/fix_elf/patch.cpp b/tools/fix_elf/patch.cpp
index d49ebab307..d3841fade4 100644
--- a/tools/fix_elf/patch.cpp
+++ b/tools/fix_elf/patch.cpp
@@ -6,43 +6,43 @@
#include <util/generic/hash.h>
#include <util/stream/null.h>
#include <util/string/cast.h>
-#include <util/system/defaults.h>
+#include <util/system/defaults.h>
namespace NElf {
bool IsElf(const TString& path) {
TUnbufferedFileInput in(path);
- char buffer[EI_NIDENT];
- size_t nread = in.Load(buffer, sizeof(buffer));
-
- if (nread != sizeof(buffer) || TStringBuf(buffer, SELFMAG) != ELFMAG) {
- Cerr << "fix_elf skip " << path << " (not an ELF file)";
- return false;
- }
-
- if (buffer[EI_CLASS] != ELFCLASS64) {
- Cerr << "fix_elf skip " << path << " (ELF class is not ELF64)";
- return false;
- }
-
-#ifdef _little_endian_
- if (buffer[EI_DATA] != ELFDATA2LSB) {
- Cerr << "fix_elf skip " << path << " (ELF byte order is not native LSB)";
- return false;
- }
-#else
- if (buffer[EI_DATA] != ELFDATA2MSB) {
- Cerr << "fix_elf skip " << path << " (ELF byte order is not native MSB)";
- return false;
- }
-#endif
-
- if (buffer[EI_VERSION] != 1) {
- Cerr << "fix_elf skip " << path << " (ELF version is not 1)";
- return false;
- }
-
- return true;
+ char buffer[EI_NIDENT];
+ size_t nread = in.Load(buffer, sizeof(buffer));
+
+ if (nread != sizeof(buffer) || TStringBuf(buffer, SELFMAG) != ELFMAG) {
+ Cerr << "fix_elf skip " << path << " (not an ELF file)";
+ return false;
+ }
+
+ if (buffer[EI_CLASS] != ELFCLASS64) {
+ Cerr << "fix_elf skip " << path << " (ELF class is not ELF64)";
+ return false;
+ }
+
+#ifdef _little_endian_
+ if (buffer[EI_DATA] != ELFDATA2LSB) {
+ Cerr << "fix_elf skip " << path << " (ELF byte order is not native LSB)";
+ return false;
+ }
+#else
+ if (buffer[EI_DATA] != ELFDATA2MSB) {
+ Cerr << "fix_elf skip " << path << " (ELF byte order is not native MSB)";
+ return false;
+ }
+#endif
+
+ if (buffer[EI_VERSION] != 1) {
+ Cerr << "fix_elf skip " << path << " (ELF version is not 1)";
+ return false;
+ }
+
+ return true;
}
} // namespace NElf
diff --git a/tools/fix_elf/patch.h b/tools/fix_elf/patch.h
index c3dcd24224..de5b1a3b8c 100644
--- a/tools/fix_elf/patch.h
+++ b/tools/fix_elf/patch.h
@@ -23,7 +23,7 @@ public:
Map.Map(0, Map.Length());
Begin = reinterpret_cast<char*>(Map.Ptr());
- if (Map.Length() < static_cast<i64>(sizeof(Elf64_Ehdr)) || TStringBuf(Begin, SELFMAG) != ELFMAG) {
+ if (Map.Length() < static_cast<i64>(sizeof(Elf64_Ehdr)) || TStringBuf(Begin, SELFMAG) != ELFMAG) {
ythrow yexception() << path << " is not an ELF file";
}
}