summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b3debd2)
raw | patch | inline | side by side (parent: b3debd2)
author | Petr Kodl <petrkodl@gmail.com> | |
Sat, 24 Jan 2009 14:04:39 +0000 (15:04 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 17 Mar 2009 16:21:32 +0000 (09:21 -0700) |
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/mingw.c | patch | blob | history | |
compat/mingw.h | patch | blob | history |
diff --git a/compat/mingw.c b/compat/mingw.c
index f66ad56aae969e93643915db8fd6272f5f662975..171fa85e4ae9fa026bbb72e2e8b8b098d2ba22ed 100644 (file)
--- a/compat/mingw.c
+++ b/compat/mingw.c
printf("Launching default browser to display HTML ...\n");
ShellExecute(NULL, "open", htmlpath, NULL, "\\", 0);
}
+
+int link(const char *oldpath, const char *newpath)
+{
+ typedef BOOL WINAPI (*T)(const char*, const char*, LPSECURITY_ATTRIBUTES);
+ static T create_hard_link = NULL;
+ if (!create_hard_link) {
+ create_hard_link = (T) GetProcAddress(
+ GetModuleHandle("kernel32.dll"), "CreateHardLinkA");
+ if (!create_hard_link)
+ create_hard_link = (T)-1;
+ }
+ if (create_hard_link == (T)-1) {
+ errno = ENOSYS;
+ return -1;
+ }
+ if (!create_hard_link(newpath, oldpath, NULL)) {
+ errno = err_win_to_posix(GetLastError());
+ return -1;
+ }
+ return 0;
+}
diff --git a/compat/mingw.h b/compat/mingw.h
index 6e246864429e276f116761e64bf89eb6e036fc28..7e52f3607f82d58141086b627c2e7167f2c05323 100644 (file)
--- a/compat/mingw.h
+++ b/compat/mingw.h
{ errno = ENOSYS; return -1; }
static inline int symlink(const char *oldpath, const char *newpath)
{ errno = ENOSYS; return -1; }
-static inline int link(const char *oldpath, const char *newpath)
-{ errno = ENOSYS; return -1; }
static inline int fchmod(int fildes, mode_t mode)
{ errno = ENOSYS; return -1; }
static inline int fork(void)
struct passwd *getpwuid(int uid);
int setitimer(int type, struct itimerval *in, struct itimerval *out);
int sigaction(int sig, struct sigaction *in, struct sigaction *out);
+int link(const char *oldpath, const char *newpath);
/*
* replacements of existing functions