diff options
author | Michael Widenius <monty@askmonty.org> | 2010-11-25 00:57:34 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2010-11-25 00:57:34 +0200 |
commit | 1a6373e8e2f0c8c5ca6b8ef5076dcb2948eeb41a (patch) | |
tree | ff2e875015b39ca3c66eba19d145dd014d4e768e /mysys | |
parent | b16c389248d03f0c3de549884f607f3f191827b4 (diff) | |
parent | 5e100a64b51aa2dd09a9a1679413fa03797a95a2 (diff) | |
download | mariadb-git-1a6373e8e2f0c8c5ca6b8ef5076dcb2948eeb41a.tar.gz |
Merge with MySQL 5.1.53
Open issues:
- A better fix for #57688; Igor is working on this
- Test failure in index_merge_innodb.test ; Igor promised to look at this
- Some Innodb tests fails (need to merge with latest xtradb) ; Kristian promised to look at this.
- Failing tests: innodb_plugin.innodb_bug56143 innodb_plugin.innodb_bug56632 innodb_plugin.innodb_bug56680 innodb_plugin.innodb_bug57255
- Werror is disabled; Should be enabled after merge with xtradb.
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/my_gethostbyname.c | 11 | ||||
-rw-r--r-- | mysys/my_gethwaddr.c | 32 | ||||
-rw-r--r-- | mysys/my_symlink.c | 15 | ||||
-rw-r--r-- | mysys/my_sync.c | 7 | ||||
-rw-r--r-- | mysys/thr_mutex.c | 4 |
5 files changed, 38 insertions, 31 deletions
diff --git a/mysys/my_gethostbyname.c b/mysys/my_gethostbyname.c index abd388302be..12cf90271dd 100644 --- a/mysys/my_gethostbyname.c +++ b/mysys/my_gethostbyname.c @@ -91,12 +91,11 @@ extern pthread_mutex_t LOCK_gethostbyname_r; is finished with the structure. */ -struct hostent * -my_gethostbyname_r(const char *name, - struct hostent *result __attribute__((unused)), - char *buffer __attribute__((unused)), - int buflen __attribute__((unused)), - int *h_errnop) +struct hostent *my_gethostbyname_r(const char *name, + struct hostent *res __attribute__((unused)), + char *buffer __attribute__((unused)), + int buflen __attribute__((unused)), + int *h_errnop) { struct hostent *hp; pthread_mutex_lock(&LOCK_gethostbyname_r); diff --git a/mysys/my_gethwaddr.c b/mysys/my_gethwaddr.c index 00e0e90f1e4..90908bd1c0d 100644 --- a/mysys/my_gethwaddr.c +++ b/mysys/my_gethwaddr.c @@ -21,18 +21,6 @@ #ifndef MAIN -#if defined(__FreeBSD__) || defined(__linux__) -static my_bool memcpy_and_test(uchar *to, uchar *from, uint len) -{ - uint i, res=1; - - for (i=0; i < len; i++) - if ((*to++= *from++)) - res=0; - return res; -} -#endif /* FreeBSD || linux */ - #ifdef __FreeBSD__ #include <net/ethernet.h> @@ -44,10 +32,11 @@ static my_bool memcpy_and_test(uchar *to, uchar *from, uint len) my_bool my_gethwaddr(uchar *to) { size_t len; - uchar *buf, *next, *end, *addr; + char *buf, *next, *end; struct if_msghdr *ifm; struct sockaddr_dl *sdl; int res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0}; + char zero_array[ETHER_ADDR_LEN] = {0}; if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1) goto err; @@ -63,9 +52,9 @@ my_bool my_gethwaddr(uchar *to) ifm = (struct if_msghdr *)next; if (ifm->ifm_type == RTM_IFINFO) { - sdl = (struct sockaddr_dl *)(ifm + 1); - addr=LLADDR(sdl); - res=memcpy_and_test(to, addr, ETHER_ADDR_LEN); + sdl= (struct sockaddr_dl *)(ifm + 1); + memcpy(to, LLADDR(sdl), ETHER_ADDR_LEN); + res= memcmp(to, zero_array, ETHER_ADDR_LEN) ? 0 : 1; } } @@ -81,8 +70,9 @@ err: my_bool my_gethwaddr(uchar *to) { - int fd, res=1; + int fd, res= 1; struct ifreq ifr; + char zero_array[ETHER_ADDR_LEN] = {0}; fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd < 0) @@ -91,9 +81,13 @@ my_bool my_gethwaddr(uchar *to) bzero(&ifr, sizeof(ifr)); strnmov(ifr.ifr_name, "eth0", sizeof(ifr.ifr_name) - 1); - do { + do + { if (ioctl(fd, SIOCGIFHWADDR, &ifr) >= 0) - res=memcpy_and_test(to, (uchar *)&ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN); + { + memcpy(to, &ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN); + res= memcmp(to, zero_array, ETHER_ADDR_LEN) ? 0 : 1; + } } while (res && (errno == 0 || errno == ENODEV) && ifr.ifr_name[3]++ < '6'); close(fd); diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c index 33f45a882e1..164533ad765 100644 --- a/mysys/my_symlink.c +++ b/mysys/my_symlink.c @@ -113,7 +113,6 @@ int my_is_symlink(const char *filename __attribute__((unused))) #endif } - /* Resolve all symbolic links in path 'to' may be equal to 'filename' @@ -150,7 +149,21 @@ int my_realpath(char *to, const char *filename, } DBUG_RETURN(result); #else +#ifdef _WIN32 + int ret= GetFullPathName(filename,FN_REFLEN, to, NULL); + if (ret == 0 || ret > FN_REFLEN) + { + if (ret > FN_REFLEN) + my_errno= ENAMETOOLONG; + else + my_errno= EACCES; + if (MyFlags & MY_WME) + my_error(EE_REALPATH, MYF(0), filename, my_errno); + return -1; + } +#else my_load_path(to, filename, NullS); +#endif return 0; #endif } diff --git a/mysys/my_sync.c b/mysys/my_sync.c index a2b615a8661..dae20b0163e 100644 --- a/mysys/my_sync.c +++ b/mysys/my_sync.c @@ -64,7 +64,7 @@ int my_sync(File fd, myf my_flags) /* Some file systems don't support F_FULLFSYNC and fail above: */ DBUG_PRINT("info",("fcntl(F_FULLFSYNC) failed, falling back")); #endif -#if defined(HAVE_FDATASYNC) +#if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC res= fdatasync(fd); #elif defined(HAVE_FSYNC) res= fsync(fd); @@ -97,6 +97,7 @@ int my_sync(File fd, myf my_flags) static const char cur_dir_name[]= {FN_CURLIB, 0}; + /* Force directory information to disk. @@ -108,6 +109,7 @@ static const char cur_dir_name[]= {FN_CURLIB, 0}; RETURN 0 if ok, !=0 if error */ + int my_sync_dir(const char *dir_name __attribute__((unused)), myf my_flags __attribute__((unused))) { @@ -138,7 +140,6 @@ int my_sync_dir(const char *dir_name __attribute__((unused)), #endif } - /* Force directory information to disk. @@ -150,6 +151,7 @@ int my_sync_dir(const char *dir_name __attribute__((unused)), RETURN 0 if ok, !=0 if error */ + int my_sync_dir_by_file(const char *file_name __attribute__((unused)), myf my_flags __attribute__((unused))) { @@ -162,4 +164,3 @@ int my_sync_dir_by_file(const char *file_name __attribute__((unused)), return 0; #endif } - diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c index 5ab1e443a88..77f2286b3d1 100644 --- a/mysys/thr_mutex.c +++ b/mysys/thr_mutex.c @@ -527,8 +527,8 @@ int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp, const char *file, int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, - struct timespec *abstime, - const char *file, uint line) + const struct timespec *abstime, + const char *file, uint line) { int error; safe_mutex_t save_state; |