]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commit
Consider flags for CreateFileA(), Windows
authorWolfgang Stöggl <c72578@yahoo.de>
Wed, 24 Apr 2019 13:29:54 +0000 (15:29 +0200)
committerTobias Oetiker <tobi@oetiker.ch>
Wed, 24 Apr 2019 15:06:52 +0000 (17:06 +0200)
commit0d6e25e08b85eeffa38896f211af4825070714a9
treebd689039ccfc1833bb1a92eba6aaedf266e985af
parent66bdfa898e35b815b770b2fcfcc148fcfc5100aa
Consider flags for CreateFileA(), Windows

- Implement dwDesiredAccess and dwCreationDisposition based on
  the flags O_RDONLY, O_RDWR, O_CREAT | O_TRUNC and O_EXCL
- This updates how a file handle is created using CreateFileA()
  under Windows, considering the flags. Use e.g.
  DesiredAccess = GENERIC_READ | GENERIC_WRITE
  dwCreationDisposition = OPEN_EXISTING
- CreateFileA(): Check for INVALID_HANDLE_VALUE and add output of error
  messages using GetLastError() and FormatMessage()
- The error message provides correct output now, which error occurs.
  e.g.: rrdtool.exe info not_existing_file.rrd
    ERROR: opening 'not_existing_file.rrd':
    The system cannot find the file specified.
  Previously, the following error occurred later in the code:
    ERROR: short read while reading header rrd->stat_head
  And also empty files were left behind:
  e.g. rrdtool.exe resize not_existing_file.rrd 0 GROW 5200
- Use <CharacterSet>MultiByte</CharacterSet> consistently
  in .vcxproj files. There were 4 inadvertent occurrences of
  <CharacterSet>Unicode</CharacterSet> in librrd-4.vcxproj.
  Using MultiByte or NotSet instead of Unicode is required for
  printing "(LPTSTR) lpMsgBuf" from FormatMessage() using %s, to avoid
  unnecessary wide characters.
- This commit is an update to a9671a7
src/rrd_open.c
win32/librrd-4.vcxproj