/* Open a descriptor to a file.
- Copyright (C) 2007-2009 Free Software Foundation, Inc.
+ Copyright (C) 2007-2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
va_start (arg, flags);
/* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
- creates crashing code when 'mode_t' is smaller than 'int'. */
+ creates crashing code when 'mode_t' is smaller than 'int'. */
mode = va_arg (arg, PROMOTED_MODE_T);
va_end (arg);
{
size_t len = strlen (filename);
if (len > 0 && filename[len - 1] == '/')
- {
- errno = EISDIR;
- return -1;
- }
+ {
+ errno = EISDIR;
+ return -1;
+ }
}
#endif
/* We know len is positive, since open did not fail with ENOENT. */
size_t len = strlen (filename);
if (filename[len - 1] == '/')
- {
- struct stat statbuf;
-
- if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode))
- {
- close (fd);
- errno = ENOTDIR;
- return -1;
- }
- }
+ {
+ struct stat statbuf;
+
+ if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode))
+ {
+ close (fd);
+ errno = ENOTDIR;
+ return -1;
+ }
+ }
}
#endif