summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 812bdbc)
raw | patch | inline | side by side (parent: 812bdbc)
author | Frank Li <lznuaa@gmail.com> | |
Wed, 16 Sep 2009 08:20:17 +0000 (10:20 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 19 Sep 2009 03:00:41 +0000 (20:00 -0700) |
MSVC does not understand this C99 style.
Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/mingw.c | patch | blob | history | |
help.c | patch | blob | history | |
run-command.c | patch | blob | history |
diff --git a/compat/mingw.c b/compat/mingw.c
index 36ef8d32147f003fb3912e6e08f8ad13cb370868..5478b747ceebfd44e9e5b45cda5267244acb8ff6 100644 (file)
--- a/compat/mingw.c
+++ b/compat/mingw.c
{
va_list args;
unsigned mode;
+ int fd;
+
va_start(args, oflags);
mode = va_arg(args, int);
va_end(args);
if (!strcmp(filename, "/dev/null"))
filename = "nul";
- int fd = open(filename, oflags, mode);
+
+ fd = open(filename, oflags, mode);
+
if (fd < 0 && (oflags & O_CREAT) && errno == EACCES) {
DWORD attrs = GetFileAttributes(filename);
if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY))
static void free_path_split(char **path)
{
+ char **p = path;
+
if (!path)
return;
- char **p = path;
while (*p)
free(*p++);
free(path);
#undef signal
sig_handler_t mingw_signal(int sig, sig_handler_t handler)
{
+ sig_handler_t old = timer_fn;
if (sig != SIGALRM)
return signal(sig, handler);
- sig_handler_t old = timer_fn;
timer_fn = handler;
return old;
}
if (dir->dd_handle == (long)INVALID_HANDLE_VALUE && dir->dd_stat == 0)
{
+ DWORD lasterr;
handle = FindFirstFileA(dir->dd_name, &buf);
- DWORD lasterr = GetLastError();
+ lasterr = GetLastError();
dir->dd_handle = (long)handle;
if (handle == INVALID_HANDLE_VALUE && (lasterr != ERROR_NO_MORE_FILES)) {
errno = err_win_to_posix(lasterr);
index 294337e71c0c8f1c3e150dd0b566c04db96c013d..fd51b8e8ef748a146676de6192e0fb9170ed8836 100644 (file)
--- a/help.c
+++ b/help.c
return 0;
#ifdef __MINGW32__
- /* cannot trust the executable bit, peek into the file instead */
+{ /* cannot trust the executable bit, peek into the file instead */
char buf[3] = { 0 };
int n;
int fd = open(name, O_RDONLY);
st.st_mode |= S_IXUSR;
close(fd);
}
+}
#endif
return st.st_mode & S_IXUSR;
}
diff --git a/run-command.c b/run-command.c
index ac314a5a8d96d74a36dd2f274707204142e84b7b..02aaedfb8ca21d5fa706753937d5a1f7a7452038 100644 (file)
--- a/run-command.c
+++ b/run-command.c
error("cannot fork() for %s: %s", cmd->argv[0],
strerror(failed_errno = errno));
#else
+{
int s0 = -1, s1 = -1, s2 = -1; /* backups of stdin, stdout, stderr */
const char **sargv = cmd->argv;
char **env = environ;
dup2(s1, 1), close(s1);
if (s2 >= 0)
dup2(s2, 2), close(s2);
+}
#endif
if (cmd->pid < 0) {