Changeset 204 for branches/samba-3.2.x/source/lib
- Timestamp:
- May 20, 2009, 6:46:53 PM (16 years ago)
- Location:
- branches/samba-3.2.x/source/lib
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.2.x/source/lib/interface.c
r141 r204 132 132 133 133 /**************************************************************************** 134 How many interfaces do we have (v4 only)?135 **************************************************************************/ 136 137 int iface_count_v4 (void)134 How many non-loopback IPv4 interfaces do we have ? 135 **************************************************************************/ 136 137 int iface_count_v4_nl(void) 138 138 { 139 139 int ret = 0; … … 141 141 142 142 for (i=local_interfaces;i;i=i->next) { 143 if (is_loopback_addr(&i->ip)) { 144 continue; 145 } 143 146 if (i->ip.ss_family == AF_INET) { 144 147 ret++; -
branches/samba-3.2.x/source/lib/tdb/common/io.c
r133 r204 208 208 #ifdef HAVE_MMAP 209 209 if (tdb->map_ptr) { 210 int ret = munmap(tdb->map_ptr, tdb->map_size); 210 int ret; 211 212 ret = munmap(tdb->map_ptr, tdb->map_size); 211 213 if (ret != 0) 212 214 return ret; -
branches/samba-3.2.x/source/lib/tdb/common/transaction.c
r133 r204 569 569 return -1; 570 570 } 571 #ifdef MS_SYNC571 #ifdef HAVE_MMAP 572 572 if (tdb->map_ptr) { 573 573 tdb_off_t moffset = offset & ~(tdb->page_size-1); -
branches/samba-3.2.x/source/lib/time.c
r138 r204 827 827 ****************************************************************************/ 828 828 829 time_t get_create_time(const SMB_STRUCT_STAT *st,bool fake_dirs)829 static time_t calc_create_time(const SMB_STRUCT_STAT *st) 830 830 { 831 831 time_t ret, ret1; 832 832 833 if(S_ISDIR(st->st_mode) && fake_dirs) {834 return (time_t)315493200L; /* 1/1/1980 */835 }836 837 833 ret = MIN(st->st_ctime, st->st_mtime); 838 834 ret1 = MIN(ret, st->st_atime); … … 849 845 } 850 846 851 struct timespec get_create_timespec(const SMB_STRUCT_STAT *st,bool fake_dirs) 852 { 853 struct timespec ts; 854 ts.tv_sec = get_create_time(st, fake_dirs); 855 ts.tv_nsec = 0; 856 return ts; 847 /**************************************************************************** 848 Return the 'create time' from a stat struct if it exists (birthtime) or else 849 use the best approximation. 850 ****************************************************************************/ 851 852 struct timespec get_create_timespec(const SMB_STRUCT_STAT *pst,bool fake_dirs) 853 { 854 struct timespec ret; 855 856 if(S_ISDIR(pst->st_mode) && fake_dirs) { 857 ret.tv_sec = 315493200L; /* 1/1/1980 */ 858 ret.tv_nsec = 0; 859 return ret; 860 } 861 862 #if defined(HAVE_STAT_ST_BIRTHTIMESPEC) 863 ret = pst->st_birthtimespec; 864 #elif defined(HAVE_STAT_ST_BIRTHTIMENSEC) 865 ret.tv_sec = pst->st_birthtime; 866 ret.tv_nsec = pst->st_birthtimenspec; 867 #elif defined(HAVE_STAT_ST_BIRTHTIME) 868 ret.tv_sec = pst->st_birthtime; 869 ret.tv_nsec = 0; 870 #else 871 ret.tv_sec = calc_create_time(pst); 872 ret.tv_nsec = 0; 873 #endif 874 875 /* Deal with systems that don't initialize birthtime correctly. 876 * Pointed out by SATOH Fumiyasu <fumiyas@osstech.jp>. 877 */ 878 if (null_timespec(ret)) { 879 ret.tv_sec = calc_create_time(pst); 880 ret.tv_nsec = 0; 881 } 882 return ret; 857 883 } 858 884 -
branches/samba-3.2.x/source/lib/util_sock.c
r141 r204 1380 1380 } 1381 1381 1382 /**************************************************************************** 1383 Create an outgoing TCP socket to any of the addrs. This is for 1384 simultaneous connects to port 445 and 139 of a host or even a variety 1385 of DC's all of which are equivalent for our purposes. 1386 **************************************************************************/ 1382 /******************************************************************* 1383 Create an outgoing TCP socket to the first addr that connects. 1384 1385 This is for simultaneous connection attempts to port 445 and 139 of a host 1386 or for simultatneous connection attempts to multiple DCs at once. We return 1387 a socket fd of the first successful connection. 1388 1389 @param[in] addrs list of Internet addresses and ports to connect to 1390 @param[in] num_addrs number of address/port pairs in the addrs list 1391 @param[in] timeout time after which we stop waiting for a socket connection 1392 to succeed, given in milliseconds 1393 @param[out] fd_index the entry in addrs which we successfully connected to 1394 @param[out] fd fd of the open and connected socket 1395 @return true on a successful connection, false if all connection attempts 1396 failed or we timed out 1397 *******************************************************************/ 1387 1398 1388 1399 bool open_any_socket_out(struct sockaddr_storage *addrs, int num_addrs, -
branches/samba-3.2.x/source/lib/util_str.c
r141 r204 2007 2007 bool str_list_substitute(char **list, const char *pattern, const char *insert) 2008 2008 { 2009 TALLOC_CTX *ctx = list; 2009 2010 char *p, *s, *t; 2010 2011 ssize_t ls, lp, li, ld, i, d; … … 2029 2030 d = p -t; 2030 2031 if (ld) { 2031 t = (char *) SMB_MALLOC(ls +ld +1);2032 t = TALLOC_ARRAY(ctx, char, ls +ld +1); 2032 2033 if (!t) { 2033 2034 DEBUG(0,("str_list_substitute: " … … 2037 2038 memcpy(t, *list, d); 2038 2039 memcpy(t +d +li, p +lp, ls -d -lp +1); 2039 SAFE_FREE(*list);2040 TALLOC_FREE(*list); 2040 2041 *list = t; 2041 2042 ls += ld;
Note:
See TracChangeset
for help on using the changeset viewer.