Commit Graph

54 Commits

Author SHA1 Message Date
Erik Larsson
ef09702b0c ntfstruncate.c: Fix mixed endianness usage of variable 'i'.
In 'dump_resident_attr_val', 'i' was sometimes used as a native-endian
'int'-precision string length value and sometimes used as a little-
endian 16-bit flags value. This type of mixed usage is bad practice and
results in a hard error when strict endianness checking is used.

Fixed by introducing new variable 'flags' to hold the little-endian 16-
bit flags value.
2016-01-26 10:28:38 +01:00
Erik Larsson
7e9003b147 ntfstruncate.c: Fix incorrect type for CPU-endian value in 'ucstos'. 2016-01-26 10:19:44 +01:00
Erik Larsson
1b67b943df ntfstruncate.c: Fix conflicting endianness for variable 'attr_type'.
If the attribute type is specified by the user, 'attr_type' was assigned
a CPU-endian value, however if the attribute type was not specified it
would be assigned the attribute type AT_DATA, which is a little-endian
value. The rest of the code seems to assume that 'attr_type' is
CPU-endian, so this is clearly a bug.

Resolved by fixing the endianness of the variable at little-endian,
converting the input value to little-endian when specified.
2016-01-26 10:18:51 +01:00
Erik Larsson
efa876d31b ntfstruncate.c: Fix mixed endianness usage of variable 'u'.
In 'dump_attr_record' the variable 'u' was first used to store a
CPU-endian 32-bit value, and then to store a 16-bit little-endian value.
This is bad practice and results in a hard error when strict endian type
checking is used.

Fixed by storing the 16-bit little-endian flags value in a new variable
'flags'.
2016-01-26 10:03:36 +01:00
Erik Larsson
75da0ce302 Fix inverted usage of endian conversion macros.
This is mostly a semantic issue since the end result would be the same.
2016-01-04 10:08:15 +01:00
Erik Larsson
9cf04fd2cd Fix incorrect usage of native/little-endian types, signed types, etc.
This is harmless with regard to code generation but if we turn on strict
type checking these type mismatches will result in errors.
2015-12-21 23:55:31 +01:00
Erik Larsson
f076fae75a Fix endianness issues in log and terminal output.
This commit addresses issues where little-endian variables are emitted
raw to a log or output stream which is to be interpreted by the user.

Outputting data in non-native endianness can cause confusion for anybody
attempting to debug issues with a file system.
2015-12-21 23:31:09 +01:00
Jean-Pierre André
c0287870e1 Returned success from ntfsprogs utilities with options --version and --help
The ntfsprogs used to return failure when option --version or --help
was used, and this has triggered complains from distribution packagers
who use these options in packaging scripts.
With this patch, success is returned (same behavior as gcc).
2014-04-23 10:13:27 +02:00
Erik Larsson
7506d8b80b Rename legacy MS_* flags for ntfs_mount with NTFS_MNT_* flags.
The MS_* flags originated from system constants. However the flags
passed to ntfs_mount were really unrelated to the system constants and
many new MS_* flags had to be introduced as different features were
added to the library. Those flags had no counterparts in any system
APIs, so using the same naming scheme is inappropriate.

Instead, let's namespace these flags similarly to what has already been
done in ntfsprogs/libntfs earlier. This avoids any possible conflicts
with system constants.
The values of the flags themselves are kept the same as earlier, so
backward compatibility is retained.
2012-11-07 16:29:48 +01:00
Erik Larsson
c3e651047a Replaced some usages of ntfs_mbstoucs_libntfscompat with ntfs_mbstoucs.
Some calls to ntfs_mbstoucs_libntfscompat were unnecessary as they only used
functionality that can be provided by ntfs_mbstoucs.
2011-09-13 09:51:55 +02:00
Jean-Pierre André
0ec31405c6 Fixed casting data to printf format in ntfsck, ntfsmove and ntfswipe 2011-07-05 12:17:28 +02:00
Erik Larsson
bcdc76f12d Merge remote branch 'linux-ntfs/libntfs-3g_port-v2_0_0' into PERMISSION_HANDLING_BRANCH
Conflicts:
	.cvsignore
	AUTHORS
	CREDITS
	ChangeLog
	NEWS
	README
	TODO.libntfs
	autogen.sh
	configure.ac
	include/ntfs/Makefile.am
	libntfs-3g/misc.c
	libntfs/Makefile.am
	libntfs/gnome-vfs-method.c
	libntfs/gnome-vfs-module.c
	ntfsprogs.spec.in
	ntfsprogs/.cvsignore
	ntfsprogs/mkntfs.c
	ntfsprogs/ntfscat.8.in
	ntfsprogs/ntfsclone.c
	ntfsprogs/ntfscp.8.in
	ntfsprogs/ntfsinfo.c
	ntfsprogs/ntfsprogs.8.in
	ntfsprogs/ntfsresize.c
	ntfsprogs/ntfsrm.c
	ntfsprogs/ntfsundelete.h
	ntfsprogs/upcase.c
	ntfsprogs/utils.c
	test/Makefile.am
2010-12-17 09:04:01 +01:00
Erik Larsson
16dbcbec0c Restored 'local' includes for all the ntfsprogs instead of using system includes (e.g. #include "yada.h" instead of #include <ntfs-3g/yada.h>). 2010-12-16 09:59:42 +01:00
Erik Larsson
6ff5d3f8a7 Replaced all occurrences of the libntfs mount flag NTFS_MNT_RDONLY with the corresponding libntfs-3g mount flag MS_RDONLY. 2010-12-02 22:36:58 +01:00
Erik Larsson
713fbb390e Merge commit 'v2_0_0' into libntfs-3g_port-v2_0_0
Conflicts:
	configure.ac
	include/ntfs/Makefile.am
	include/ntfs/attrib.h
	include/ntfs/bitmap.h
	include/ntfs/collate.h
	include/ntfs/debug.h
	include/ntfs/dir.h
	include/ntfs/endians.h
	include/ntfs/index.h
	include/ntfs/inode.h
	include/ntfs/layout.h
	include/ntfs/logfile.h
	include/ntfs/logging.h
	include/ntfs/mft.h
	include/ntfs/ntfstime.h
	include/ntfs/runlist.h
	include/ntfs/support.h
	include/ntfs/types.h
	include/ntfs/unistr.h
	include/ntfs/volume.h
	libntfs/Makefile.am
	libntfs/attrib.c
	libntfs/attrlist.c
	libntfs/bitmap.c
	libntfs/bootsect.c
	libntfs/collate.c
	libntfs/compress.c
	libntfs/debug.c
	libntfs/device.c
	libntfs/device_io.c
	libntfs/dir.c
	libntfs/index.c
	libntfs/inode.c
	libntfs/lcnalloc.c
	libntfs/logfile.c
	libntfs/logging.c
	libntfs/mft.c
	libntfs/mst.c
	libntfs/runlist.c
	libntfs/security.c
	libntfs/unistr.c
	libntfs/unix_io.c
	libntfs/volume.c
	libntfs/win32_io.c
	ntfsprogs/Makefile.am
	ntfsprogs/mkntfs.c
	ntfsprogs/ntfscat.c
	ntfsprogs/ntfsclone.c
	ntfsprogs/ntfscmp.c
	ntfsprogs/ntfscp.c
	ntfsprogs/ntfsinfo.c
	ntfsprogs/ntfsmount.8.in
	ntfsprogs/ntfsmount.c
	ntfsprogs/ntfsundelete.c
	ntfsprogs/upcase.c
2010-12-02 22:31:21 +01:00
Erik Larsson
13bef7f308 ntfstruncate.c: Changed one reference to ntfs_mbstoucs into ntfs_mbstoucs_libntfscompat. 2010-12-02 16:51:49 +01:00
Erik Larsson
196f7f6461 Commented out all references to 'version.h' in the 'extra' utilities until libntfs-3g supports such functionality. 2010-12-02 16:49:56 +01:00
Erik Larsson
07bc8d9d17 Redirected all libntfs includes in the 'extra' utilities to libntfs-3g. 2010-12-02 16:47:06 +01:00
Erik Larsson
5b9b4c7e49 Removing all references to the libntfs library version until we have such functionality in libntfs-3g. 2010-12-02 16:38:16 +01:00
aia21
5f3079c2bb Fix ntfstruncate build breakage. 2006-12-13 10:51:32 +00:00
yura
cb27c9f616 * Rename MS_{RDONLY,NOATIME} to NTFS_MNT_{RDONLY,NOATIME}.
* Introduce NTFS_MNT_CASE_SENSITIVE.
2006-11-12 22:46:50 +00:00
szaka
be823c7a1e libntfs: add ntfs_str2ucs and ntfs_freeucs function, and convert
copy-pastes to use them
2006-04-05 02:45:55 +00:00
flatcap
abf0cfba5d use new logging 2005-11-20 14:15:33 +00:00
flatcap
8a584700c5 whitespace fixes - no code changes 2005-10-26 22:54:57 +00:00
flatcap
f4e427e91a implement logging in libntfs
fix whitespace
fix build problems
tidy source code
and more...
2005-10-21 18:05:13 +00:00
flatcap
42de4cf905 tidy up some __attribute__ usage 2005-10-12 11:52:40 +00:00
antona
0c293d0407 - Add API (actually renamed from what Rich/FlatCap did):
volume.[hc]::ntfs_libntfs_version() which returns a pointer to a
  static const string of the libntfs verion, i.e. at the moment this is
  "8.0.0".  This required moving the version specifications from
  libntfs/Makefile.am to configure.ac.  This should hopefully have the
  sideeffect that I will remember to increment it when incrementing the
  ntfsprogs version number when making a release given the two are
  right under one another.  (Anton)
- Change ALL utilities to display the libntfs version they are running
  on.  This should make debugging easier in the case that people are
  running mismatched utilities/library.  (Anton)
2005-10-07 14:10:56 +00:00
antona
8db479a6b1 Patch from Christophe:
A lot of headers are checked by autoconf (AC_CHECK_HEADERS in configure.ac).
Please find a patch that add the missing "#ifdef" to the source code.
2005-09-28 13:47:47 +00:00
flatcap
7a142ef54c got bored. don't read the diffs. 2005-07-06 22:47:01 +00:00
flatcap
949043ab36 Tidy whitespace: trailing space; <space><tab> at the beginning of lines
Fix warnings about sign differences
Fix warnings about unused parameters
Tidy a few functions that didn't have { on a new line
2005-06-19 21:09:40 +00:00
cantab.net!aia21
db7c9da42f Move NAttr{Sparse,Compressed,Encrypted} to inode struct preserving
the previous interface.  (Yura, with fixes from Anton)

(Logical change 1.645)
2004-12-22 14:04:41 +00:00
cantab.net!aia21
388972a4bb Revert some of Yuval's changes and fix the putative warnings differently.
(Logical change 1.511)
2004-08-20 15:26:18 +00:00
!uv
067797a112 Warning fixes: variable type changeses.
(Logical change 1.508)
2004-08-20 12:30:34 +00:00
!uv
cb04792793 A printf format fix and a warnning fix.
(Logical change 1.507)
2004-08-20 12:18:22 +00:00
!uv
27bf9c0ea0 Allow better compiler optimization/error checking.
(Logical change 1.504)
2004-08-20 11:58:24 +00:00
cantab.net!aia21
3423a8a909 Rename uchar_t to ntfschar.
(Logical change 1.392)
2004-05-14 13:02:33 +00:00
cantab.net!aia21
123b1028ec Fix lots of warnings about no prototypes by adding
the 'static' keyword.  (Yuval)

(Logical change 1.381)
2004-04-23 13:55:49 +00:00
cantab.net!aia21
12639f64b7 Update
(Logical change 1.376)
2004-04-16 21:00:27 +00:00
cantab.net!aia21
b1a398abfb Update
(Logical change 1.375)
2004-04-16 20:58:20 +00:00
cantab.net!aia21
ddeee65b8d Fix all occurences of printf with %ll length modifiers but 64 bit
arguments to typecast the arguments to (unsigned) long long to avoid
the warnings when compiling on 64 bit architectures.

(Logical change 1.306)
2004-03-09 14:47:34 +00:00
cantab.net!aia21
c9076ef627 - Apply patch from Szaka to fix all %L to %ll.
- Fix remaining %L ti %ll (compress.c).
- Run ./autogen.sh on SuSE 9.0.

(Logical change 1.263)
2004-01-15 16:57:10 +00:00
cantab.net!aia21
3b25f96395 Fix signed warnings.
(Logical change 1.223)
2003-11-04 13:04:07 +00:00
cantab.net!aia21
33c6acd353 Adapt to changes in library.
(Logical change 1.139)
2003-06-03 11:07:54 +00:00
cantab.net!aia21
fb7a94516e Typo fix...
(Logical change 1.124)
2003-02-25 18:57:15 +00:00
cantab.net!aia21
c8dae5156c cleanup flatcaps changes (reverting a few) as well as add new option
(Logical change 1.107)
2003-01-20 11:08:14 +00:00
flatcap.org!flatcap
fad40b9b78 standardise usage and version info
comment blocks

(Logical change 1.105)
2003-01-19 22:01:18 +00:00
flatcap.org!flatcap
bfb9a428eb start using the utils
(Logical change 1.104)
2003-01-19 11:48:06 +00:00
cantab.net!aia21
ef273e8804 really final tidyings
(Logical change 1.102)
2003-01-18 16:02:37 +00:00
cantab.net!aia21
a86ad90a97 Finish off / fix ability to specify an attribute name.
2002/12/29 12:03:45+00:00 cantab.net!aia21
Add ability to specify an attribute name in addition to the attribute type.

(Logical change 1.72)
2002-12-29 12:17:35 +00:00
cantab.net!aia21
ab8ae59c52 Fix debug output for offset.
Only dump attribute records for attribute being resized.

(Logical change 1.69)
2002-12-28 20:10:50 +00:00