From 4fdea323c2fbe09d69351c93c1fb315712f73e4d Mon Sep 17 00:00:00 2001
From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Sat, 8 Dec 2007 13:04:05 +0000
Subject: [PATCH] smartctl: Fixed ATA identify byte swapping issue on
 big-endian platforms.

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2440 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 sm5/CHANGELOG    | 7 ++++++-
 sm5/ataprint.cpp | 4 ++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG
index e4f149c0e..85f3d9211 100644
--- a/sm5/CHANGELOG
+++ b/sm5/CHANGELOG
@@ -1,6 +1,6 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG,v 1.641 2007/12/08 12:58:53 chrfranke Exp $
+$Id: CHANGELOG,v 1.642 2007/12/08 13:04:05 chrfranke Exp $
 
 The most recent version of this file is:
 http://smartmontools.cvs.sourceforge.net/smartmontools/sm5/CHANGELOG?view=markup
@@ -33,6 +33,11 @@ Maintainers / Developers Key:
 NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
+
+  [CF] smartctl: Fixed ATA identify byte swapping issue on big-endian
+       platforms. This regression was introduced by the change for
+       '-F swapid'. Thanks to Matthew Butch for bug report and testing.
+
   [DG] SAT/SCSI: Improve SAT error processing code. Aborted commands from
        ATA devices (typically because SMART was disabled) were not being
        properly detected.
diff --git a/sm5/ataprint.cpp b/sm5/ataprint.cpp
index 72bef8942..92a35958c 100644
--- a/sm5/ataprint.cpp
+++ b/sm5/ataprint.cpp
@@ -41,7 +41,7 @@
 #include "utility.h"
 #include "knowndrives.h"
 
-const char *ataprint_c_cvsid="$Id: ataprint.cpp,v 1.183 2007/07/21 20:59:41 chrfranke Exp $"
+const char *ataprint_c_cvsid="$Id: ataprint.cpp,v 1.184 2007/12/08 13:04:05 chrfranke Exp $"
 ATACMDNAMES_H_CVSID ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID KNOWNDRIVES_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
 
 // for passing global control variables
@@ -94,7 +94,7 @@ void trim(char *out, const char *in)
 void format_ata_string(char *out, const char *in, int n)
 {
   bool must_swap = !con->fixswappedid;
-#ifndef __NetBSD__
+#ifdef __NetBSD__
   /* NetBSD kernel delivers IDENTIFY data in host byte order (but all else is LE) */
   if (isbigendian())
     must_swap = !must_swap;
-- 
GitLab