~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to lib/fsync.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- buffer-read-only: t -*- vi: set ro: */
2
 
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3
1
/* Emulate fsync on platforms that lack it, primarily Windows and
4
2
   cross-compilers like MinGW.
5
3
 
9
7
 
10
8
   Written by Richard W.M. Jones <rjones.at.redhat.com>
11
9
 
12
 
   Copyright (C) 2008-2011 Free Software Foundation, Inc.
 
10
   Copyright (C) 2008-2012 Free Software Foundation, Inc.
13
11
 
14
12
   This library is free software; you can redistribute it and/or
15
13
   modify it under the terms of the GNU General Public
29
27
 
30
28
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
31
29
 
32
 
/* _get_osfhandle */
33
 
# include <io.h>
34
 
 
35
30
/* FlushFileBuffers */
36
31
# define WIN32_LEAN_AND_MEAN
37
32
# include <windows.h>
38
33
 
39
34
# include <errno.h>
40
35
 
 
36
/* Get _get_osfhandle.  */
 
37
# include "msvc-nothrow.h"
 
38
 
41
39
int
42
40
fsync (int fd)
43
41
{
59
57
      err = GetLastError ();
60
58
      switch (err)
61
59
        {
 
60
        case ERROR_ACCESS_DENIED:
 
61
          /* For a read-only handle, fsync should succeed, even though we have
 
62
             no way to sync the access-time changes.  */
 
63
          return 0;
 
64
 
62
65
          /* eg. Trying to fsync a tty. */
63
66
        case ERROR_INVALID_HANDLE:
64
67
          errno = EINVAL;