Changeset 454 for trunk/server/source3/lib
- Timestamp:
- Jun 4, 2010, 3:11:43 PM (15 years ago)
- Location:
- trunk/server/source3/lib
- Files:
-
- 3 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/source3/lib/charcnv.c
r414 r454 1804 1804 */ 1805 1805 1806 /* @todo eventually port old code, but probably not necessary */ 1806 1807 codepoint_t next_codepoint(const char *str, size_t *size) 1807 1808 { -
trunk/server/source3/lib/fault.c
r414 r454 54 54 if (cont_fn) { 55 55 cont_fn(NULL); 56 #ifndef __OS2__ /* don't use the built in signal capture stuff - prefer native handling of errors */ 56 57 #ifdef SIGSEGV 57 58 CatchSignal(SIGSEGV,SIGNAL_CAST SIG_DFL); … … 62 63 #ifdef SIGABRT 63 64 CatchSignal(SIGABRT,SIGNAL_CAST SIG_DFL); 65 #endif 64 66 #endif 65 67 return; /* this should cause a core dump */ … … 83 85 cont_fn = fn; 84 86 87 #ifndef __OS2__ /* don't use the built in signal capture stuff - prefer native handling of errors */ 85 88 #ifdef SIGSEGV 86 89 CatchSignal(SIGSEGV,SIGNAL_CAST sig_fault); … … 91 94 #ifdef SIGABRT 92 95 CatchSignal(SIGABRT,SIGNAL_CAST sig_fault); 96 #endif 93 97 #endif 94 98 } -
trunk/server/source3/lib/iconv.c
r414 r454 128 128 } 129 129 130 #ifdef __OS2__ 131 // i could have done a static variable w/o this function. but i feel it's nicer this way. 132 // the purpose of this function is to save the to_name to get the korean and japanese code set working 133 char * save_toname(char *toname, bool what) 134 { 135 static char *to_name=NULL; 136 137 if ( what == 0 ) 138 to_name = SMB_STRDUP(toname); 139 140 return to_name; 141 } 142 #endif 143 130 144 #ifdef HAVE_NATIVE_ICONV 131 145 /* if there was an error then reset the internal state, … … 136 150 char **outbuf, size_t *outbytesleft) 137 151 { 152 #ifdef __OS2__ 153 uint16 *outbuf_uc = ( uint16 * )*outbuf; 154 char *to_name = save_toname(NULL, 1); 155 #endif 156 138 157 size_t ret = iconv((iconv_t)cd, 139 158 (void *)inbuf, inbytesleft, … … 144 163 errno = saved_errno; 145 164 } 165 #ifdef __OS2__ 166 /* Workaround for path separator on OS/2 */ 167 else 168 { 169 if( (strstr(to_name, "949") != NULL) || /* Korean CP */ 170 (strstr(to_name, "932") != NULL) || /* Japanese CP */ 171 (strstr(to_name, "942") != NULL) || /* Japanese CP */ 172 (strstr(to_name, "943") != NULL) ) /* Japanese CP */ 173 { 174 while(( char * )outbuf_uc < *outbuf ) 175 { 176 if( *outbuf_uc == 0x20a9 || /* Korean WON */ 177 *outbuf_uc == 0x00a5 ) /* Japanese YEN */ 178 *outbuf_uc = '\\'; 179 180 outbuf_uc++; 181 } 182 } 183 } 184 #endif 185 146 186 return ret; 147 187 } … … 161 201 char *bufp = cvtbuf; 162 202 size_t bufsize; 203 #ifdef __OS2__ 204 save_toname(cd->to_name, 0); 205 #endif 163 206 164 207 /* in many cases we can go direct */ -
trunk/server/source3/lib/ldb/common/ldb.c
r414 r454 117 117 ldb_connect_fn fn; 118 118 119 #ifndef __OS2__ // on OS2 we have a semicolon at the second character if w/o backend called 119 120 if (strchr(url, ':') != NULL) { 121 #else 122 if (url[1] != ':' && strchr(url, ':') != NULL) { 123 #endif 120 124 backend = talloc_strndup(ldb, url, strchr(url, ':')-url); 121 125 } else { -
trunk/server/source3/lib/ldb/ldb_tdb/ldb_tdb.c
r414 r454 1012 1012 1013 1013 /* parse the url */ 1014 #ifndef __OS2__ // on OS2 we have a semicolon at the second character if w/o backend called 1014 1015 if (strchr(url, ':')) { 1016 #else 1017 if (url[1] != ':' && strchr(url, ':') != NULL) { 1018 #endif 1015 1019 if (strncmp(url, "tdb://", 6) != 0) { 1016 1020 ldb_debug(ldb, LDB_DEBUG_ERROR, "Invalid tdb URL '%s'", url); -
trunk/server/source3/lib/pidfile.c
r414 r454 68 68 } 69 69 70 #ifndef __OS2__ // if we lock the file, we won't be able to read it later on OS/2 70 71 if (fcntl_lock(fd,SMB_F_SETLK,0,1,F_RDLCK)) { 71 72 /* we could get the lock - it can't be a Samba process */ 72 73 goto noproc; 73 74 } 75 #endif 74 76 75 77 SAFE_FREE(pidFile); … … 95 97 /* Add a suffix to the program name if this is a process with a 96 98 * none default configuration file name. */ 99 100 /* On OS/2, CONFIGFILE will always be different to dyn_CONFIGFILE 101 as dyn_CONFIGFILE dynamically looks up the system ETC directory */ 102 #ifndef __OS2__ 103 97 104 if (strcmp( CONFIGFILE, get_dyn_CONFIGFILE()) == 0) { 98 105 name = SMB_STRDUP(program_name); … … 111 118 } 112 119 } 120 #else 121 name = SMB_STRDUP(program_name); 122 #endif 113 123 114 124 if (asprintf(&pidFile_name, "%s/%s.pid", lp_piddir(), name) == -1) { … … 144 154 exit(1); 145 155 } 156 146 157 /* Leave pid file open & locked for the duration... */ 147 158 SAFE_FREE(name); 159 #ifdef __OS2__ // If we leave the file open & locked on OS/2 - we can't read it, so close the fd 160 close(fd); 161 #endif 148 162 } 149 163 -
trunk/server/source3/lib/readline.c
r414 r454 102 102 return ret; 103 103 } 104 #ifdef __OS2__ 105 #include <conio.h> 106 { 107 char * cp = line; 108 char c; 109 int flag = 1; 110 while (flag && cp < line + sizeof(line) - 1) 111 { 112 c = getch(); 113 switch (c) 114 { 115 case 8: 116 { 117 if (cp > line) 118 { 119 cp--; 120 putchar(8); 121 putchar(32); 122 putchar(8); 123 } 124 } break; 125 case 0: break; 126 case 10: // generally should not be 127 case 13: 128 { 129 flag = 0; 130 } break; 131 case 27: 132 { 133 for (; cp > line; cp--) 134 { 135 putchar(8); 136 putchar(32); 137 putchar(8); 138 } 139 } break; 140 default: 141 { 142 *cp++ = c; 143 putchar(c); 144 } 145 } 146 } 147 *cp = 0; 148 printf("\n"); 149 return line; 150 } 151 #endif /* __OS2__ */ 152 104 153 if (callback) { 105 154 callback(); -
trunk/server/source3/lib/select.c
r414 r454 63 63 64 64 if (initialised != sys_getpid()) { 65 #ifndef __OS2__ 65 66 if (pipe(select_pipe) == -1) 67 #else 68 if (socketpair(AF_UNIX, SOCK_STREAM,0, select_pipe) == -1) 69 #endif 66 70 { 67 71 DEBUG(0, ("sys_select: pipe failed (%s)\n", -
trunk/server/source3/lib/smbrun.c
r414 r454 83 83 } 84 84 85 #ifdef __OS2__ 86 char buf[8192]; 87 int n, w; 88 const char *newcmd = sanitize ? escape_shell_string(cmd) : cmd; 89 if (!newcmd) { 90 close(*outfd); 91 *outfd = -1; 92 return(82); 93 } 94 // execute script and capture stdout 95 FILE* pipe = popen( newcmd, "rb"); 96 if (pipe) { 97 // get stdout from pipe 98 while( !feof( pipe)) { 99 n = fread( buf, 1, 8192, pipe); 100 // write to file if required 101 if (n>0 && outfd!=NULL) 102 w = write( *outfd, buf, n); 103 } 104 // close and return status 105 pclose( pipe); 106 return 0; 107 } 108 // error, close files 109 close(*outfd); 110 *outfd = -1; 111 return 83; 112 #else 85 113 /* in this method we will exec /bin/sh with the correct 86 114 arguments, after first setting stdout to point at the file */ … … 202 230 exit(83); 203 231 return 1; 232 #endif 204 233 } 205 234 -
trunk/server/source3/lib/system.c
r429 r454 641 641 #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_FTRUNCATE64) 642 642 return ftruncate64(fd, offset); 643 #elif defined(__OS2__) 644 return os2_ftruncate(fd, offset); 643 645 #else 644 646 return ftruncate(fd, offset); … … 1571 1573 } 1572 1574 return ret; 1575 #elif defined(__OS2__) 1576 return unigetxattr(path, 0, name, value, size); 1573 1577 #else 1574 1578 errno = ENOSYS; … … 1622 1626 } 1623 1627 return ret; 1628 #elif defined(__OS2__) 1629 return unigetxattr(path, 0, name, value, size); 1624 1630 #else 1625 1631 errno = ENOSYS; … … 1675 1681 } 1676 1682 return ret; 1683 #elif defined(__OS2__) 1684 return unigetxattr(0, filedes, name, value, size); 1677 1685 #else 1678 1686 errno = ENOSYS; … … 1867 1875 } 1868 1876 return ret; 1877 #elif defined(__OS2__) 1878 return unilistxattr(path, 0, list, size); 1869 1879 #else 1870 1880 errno = ENOSYS; … … 1896 1906 } 1897 1907 return ret; 1908 #elif defined(__OS2__) 1909 return unilistxattr(path, 0, list, size); 1898 1910 #else 1899 1911 errno = ENOSYS; … … 1927 1939 } 1928 1940 return ret; 1941 #elif defined(__OS2__) 1942 return unilistxattr(0, filedes, list, size); 1929 1943 #else 1930 1944 errno = ENOSYS; … … 1966 1980 } 1967 1981 return ret; 1982 #elif defined(__OS2__) 1983 return uniremovexattr (path, 0, name); 1968 1984 #else 1969 1985 errno = ENOSYS; … … 2003 2019 } 2004 2020 return ret; 2021 #elif defined(__OS2__) 2022 return uniremovexattr (path, 0, name); 2005 2023 #else 2006 2024 errno = ENOSYS; … … 2042 2060 } 2043 2061 return ret; 2062 #elif defined(__OS2__) 2063 return uniremovexattr (0, filedes, name); 2044 2064 #else 2045 2065 errno = ENOSYS; … … 2107 2127 } 2108 2128 return ret; 2129 #elif defined(__OS2__) 2130 return unisetxattr (path, 0, name, value, size, flags); 2109 2131 #else 2110 2132 errno = ENOSYS; … … 2171 2193 } 2172 2194 return ret; 2195 #elif defined(__OS2__) 2196 return unisetxattr (path, 0, name, value, size, flags); 2173 2197 #else 2174 2198 errno = ENOSYS; … … 2236 2260 } 2237 2261 return ret; 2262 #elif defined(__OS2__) 2263 return unisetxattr (0, filedes, name, value, size, flags); 2238 2264 #else 2239 2265 errno = ENOSYS; -
trunk/server/source3/lib/system_smbd.c
r414 r454 41 41 int *grpcnt) 42 42 { 43 #ifndef __OS2__groups 43 44 gid_t *gids_saved; 44 45 int ret, ngrp_saved, num_gids; … … 112 113 free(gids_saved); 113 114 return ret; 115 #else 116 *grpcnt = 0; 117 return 0; 118 #endif 114 119 } 115 120 #endif -
trunk/server/source3/lib/util.c
r414 r454 2027 2027 int set_maxfiles(int requested_max) 2028 2028 { 2029 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE) )2029 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE) && !defined(__OS2__)) 2030 2030 struct rlimit rlp; 2031 2031 int saved_current_limit; -
trunk/server/source3/lib/util_sec.c
r414 r454 93 93 static void assert_uid(uid_t ruid, uid_t euid) 94 94 { 95 #ifndef __OS2__ 95 96 if ((euid != (uid_t)-1 && geteuid() != euid) || 96 97 (ruid != (uid_t)-1 && getuid() != ruid)) { … … 103 104 } 104 105 } 106 #endif 105 107 } 106 108 … … 110 112 static void assert_gid(gid_t rgid, gid_t egid) 111 113 { 114 #ifndef __OS2__ 112 115 if ((egid != (gid_t)-1 && getegid() != egid) || 113 116 (rgid != (gid_t)-1 && getgid() != rgid)) { … … 121 124 } 122 125 } 126 #endif 123 127 } 124 128 -
trunk/server/source3/lib/util_sock.c
r414 r454 1679 1679 /* Create the socket directory or reuse the existing one */ 1680 1680 1681 #ifndef __OS2__ 1681 1682 if (lstat(socket_dir, &st) == -1) { 1682 1683 if (errno == ENOENT) { … … 1707 1708 } 1708 1709 } 1710 #endif 1709 1711 1710 1712 /* Create the socket file */ … … 1718 1720 } 1719 1721 1722 #ifdef __OS2__ 1723 if (asprintf(&path, "\\socket\\samba\\%s\\%s", socket_dir, socket_name) == -1) { 1724 #else 1720 1725 if (asprintf(&path, "%s/%s", socket_dir, socket_name) == -1) { 1726 #endif 1721 1727 goto out_close; 1722 1728 } -
trunk/server/source3/lib/util_str.c
r414 r454 2264 2264 *******************************************************************/ 2265 2265 2266 #ifdef __OS2__ 2267 #define INCLUDE_LIST "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_/ \t.,:" 2268 #else 2266 2269 #define INCLUDE_LIST "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_/ \t.," 2270 #endif 2267 2271 #define INSIDE_DQUOTE_LIST "$`\n\"\\" 2268 2272
Note:
See TracChangeset
for help on using the changeset viewer.