Changeset 191


Ignore:
Timestamp:
Oct 30, 2010, 5:23:18 PM (14 years ago)
Author:
Yuri Dario
Message:

clamav: applied os2 patches.

Location:
clamav/trunk
Files:
34 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified clamav/trunk/clamd/clamd.c

    r189 r191  
    544544            sock_mode = 0777 /* & ~umsk*/; /* conservative default: umask was 0 in clamd < 0.96 */
    545545
     546#ifndef C_OS2
    546547        if(chmod(optget(opts, "LocalSocket")->strarg, sock_mode & 0666)) {
    547548            logg("!Cannot set socket permission to %s\n", optget(opts, "LocalSocketMode")->strarg);
     
    549550            break;
    550551        }
     552#endif
    551553
    552554        nlsockets++;
     
    592594    }
    593595
    594 #ifndef _WIN32
     596#if !defined(_WIN32) && !defined(C_OS2)
    595597    if(nlsockets && localsock) {
    596598        opt = optget(opts, "LocalSocket");
  • TabularUnified clamav/trunk/clamd/scanner.c

    r189 r191  
    8484    /* detect disconnected socket,
    8585     * this should NOT detect half-shutdown sockets (SHUT_WR) */
    86     if (send(scandata->conn->sd, &ret, 0, 0) == -1 && errno != EINTR) {
     86    if (send(scandata->conn->sd, &ret, 0, 0) == -1 && errno != EINTR
     87#ifdef C_OS2
     88         && errno != EFAULT // YD length==0 may fail on os2 sockets
     89#endif
     90                ) {
    8791        logg("$Client disconnected while command was active!\n");
    8892        thrmgr_group_terminate(scandata->conn->group);
     
    121125            return CL_SUCCESS;
    122126        case warning_skipped_special:
    123             if (msg == scandata->toplevel_path)
     127            if (!strcmp(msg, scandata->toplevel_path))
    124128                conn_reply(scandata->conn, msg, "Not supported file type", "ERROR");
    125129            logg("*Not supported file type: %s\n", msg);
     
    140144
    141145    if(sb && sb->st_size == 0) { /* empty file */
    142         if (msg == scandata->toplevel_path)
     146        if (!strcmp(msg, scandata->toplevel_path))
    143147            conn_reply_single(scandata->conn, filename, "Empty file");
    144148        free(filename);
  • TabularUnified clamav/trunk/clamd/server-th.c

    r189 r191  
    10691069        event_wake_recv = CreateEvent(NULL, TRUE, FALSE, NULL);
    10701070#else
     1071
     1072#ifdef __KLIBC__
     1073    // YD libc select() does not work with pipes
     1074    if (socketpair(AF_UNIX, SOCK_STREAM,0, acceptdata.syncpipe_wake_recv) == -1 ||
     1075        (socketpair(AF_UNIX, SOCK_STREAM,0, acceptdata.syncpipe_wake_accept) == -1)) {
     1076
     1077        logg("!pipe failed\n");
     1078        exit(-1);
     1079    }
     1080#else
    10711081    if (pipe(acceptdata.syncpipe_wake_recv) == -1 ||
    10721082        (pipe(acceptdata.syncpipe_wake_accept) == -1)) {
     
    10751085        exit(-1);
    10761086    }
     1087#endif
     1088
    10771089    syncpipe_wake_recv_w = acceptdata.syncpipe_wake_recv[1];
    10781090
  • TabularUnified clamav/trunk/clamd/thrmgr.c

    r189 r191  
    4242
    4343/* BSD and HP-UX need a bigger stacksize than the system default */
    44 #if defined (C_BSD) || defined (C_HPUX) || defined(C_AIX)
     44#if defined (C_BSD) || defined (C_HPUX) || defined(C_AIX) || defined(C_OS2)
    4545#define C_BIGSTACK 1
    4646#endif
  • TabularUnified clamav/trunk/clamdscan/client.c

    r189 r191  
    132132            return NULL;
    133133        }
    134 #ifdef _WIN32
     134#if defined(_WIN32) || defined(C_OS2)
    135135        if(*basepath == '\\') {
    136136            namelen = 2;
  • TabularUnified clamav/trunk/clamdtop/Makefile.in

    r189 r191  
    297297
    298298@HAVE_CURSES_TRUE@AM_CPPFLAGS = -I$(top_srcdir) @CURSES_CPPFLAGS@
    299 @HAVE_CURSES_TRUE@clamdtop_LDADD = @CURSES_LIBS@ $(top_builddir)/libclamav/libclamav_internal_utils_nothreads.la
     299@HAVE_CURSES_TRUE@clamdtop_LDADD = @CURSES_LIBS@ -ltinfo $(top_builddir)/libclamav/libclamav_internal_utils_nothreads.la
    300300EXTRA_DIST = clamdtop.c
    301301all: all-am
  • TabularUnified clamav/trunk/clamdtop/clamdtop.c

    r189 r191  
    511511    {
    512512#else
     513
     514#ifdef C_OS2
     515        if(cli_is_abspath(soname)) {
     516#else
    513517        if(cli_is_abspath(soname) || (access(soname, F_OK) == 0)) {
     518#endif
    514519                struct sockaddr_un addr;
    515520                s = socket(AF_UNIX, SOCK_STREAM, 0);
  • TabularUnified clamav/trunk/clamscan/manager.c

    r189 r191  
    118118    }
    119119    info.rblocks += fsize / CL_COUNT_PRECISION;
    120 #ifndef _WIN32
     120#if !defined(_WIN32) && !defined(C_OS2)
    121121    if(geteuid())
    122122        if(checkaccess(filename, NULL, R_OK) != 1) {
     
    617617                ret = 2;
    618618            } else {
     619#if defined(C_OS2) || defined(_WIN32)
     620                // YD skip if 'x:\' pattern is found
     621                if (!(strlen(file)==3 && file[1]==':' && file[2]==*PATHSEP))
     622#endif
    619623                for(i = strlen(file) - 1; i > 0; i--) {
    620624                    if(file[i] == *PATHSEP)
  • TabularUnified clamav/trunk/clamscan/others.c

    r189 r191  
    8686        int ret = 0, status;
    8787
     88#if !defined(C_CYGWIN) && !defined(C_OS2) && !defined(C_BEOS)
    8889    if(!geteuid()) {
    8990
     
    118119        }
    119120
    120     } else {
     121    } else
     122#endif
     123    {
    121124        if(!access(path, mode))
    122125            ret = 1;
  • TabularUnified clamav/trunk/configure

    r189 r191  
    1387513875        if(!data3)
    1387613876                return 1;
     13877#ifdef __KLIBC__
     13878        lseek(fd,0,SEEK_SET);
     13879#endif
    1387713880        if(read (fd, data3, datasize) != datasize)
    1387813881                return 1;
  • TabularUnified clamav/trunk/freshclam/dns.c

    r189 r191  
    4949        unsigned int cttl, size, txtlen = 0;
    5050
     51#ifdef __KLIBC__
     52        static int res_init_done = 0;
     53#endif
     54
    5155
    5256    if(ttl)
    5357        *ttl = 0;
     58#ifdef __KLIBC__
     59    if (res_init_done == 0)
     60#endif
    5461    if(res_init() < 0) {
    5562        logg("^res_init failed\n");
    5663        return NULL;
    5764    }
     65#ifdef __KLIBC__
     66    res_init_done = 1; // call only once per session
     67#endif
    5868
    5969    logg("*Querying %s\n", domain);
  • TabularUnified clamav/trunk/freshclam/execute.c

    r189 r191  
    3434#include "execute.h"
    3535
     36#if defined(C_OS2)
     37#include <process.h>
     38#define _P_NOWAIT P_NOWAIT
     39#endif
     40
    3641#define MAX_CHILDREN 5
    3742
     
    5358    }
    5459
    55 #ifdef _WIN32
     60#if defined(_WIN32) || defined(C_OS2)
    5661    if(spawnlp(_P_NOWAIT, text, text, NULL) == -1) {
    5762        logg("^%s: couldn't execute \"%s\".\n", type, text);
  • TabularUnified clamav/trunk/freshclam/freshclam.c

    r189 r191  
    259259        }
    260260
    261 #ifndef _WIN32
     261#if !defined(_WIN32) && !defined(C_OS2)
    262262        if(statbuf.st_mode & (S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH)) {
    263263            logg("^Insecure permissions (for HTTPProxyPassword): %s must have no more than 0700 permissions.\n", cfgfile);
     
    269269
    270270#ifdef HAVE_PWD_H
     271#if !defined(C_OS2)
    271272    /* freshclam shouldn't work with root privileges */
    272273    dbowner = optget(opts, "DatabaseOwner")->strarg;
     
    309310        }
    310311    }
     312#endif /* C_OS2 */
    311313#endif /* HAVE_PWD_H */
    312314
  • TabularUnified clamav/trunk/freshclam/manager.c

    r189 r191  
    18001800    }
    18011801
    1802 #ifdef _WIN32
     1802#if defined(_WIN32) || defined(C_OS2)
    18031803    if(!access(newdb, R_OK) && unlink(newdb)) {
    18041804        logg("!Can't unlink %s. Please fix the problem manually and try again.\n", newdb);
  • TabularUnified clamav/trunk/libclamav/Makefile.in

    r189 r191  
    1313# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
    1414# PARTICULAR PURPOSE.
     15
     16OS2_LA_NAME=clamav
     17OS2_DLL_NAME=clamav
     18OS2_DLL_OBJ=$(libclamav_la_OBJECTS:%.lo=.libs/%.o)  .libs/clamav_internal_utils.a .libs/clamav_nocxx.a
     19OS2_DLL_LIBS=../libltdl/.libs/ltdlc.a .libs/clamunrar_iface.a .libs/clamunrar.a $(LIBCLAMAV_LIBS) $(LIBS)
    1520
    1621@SET_MAKE@
     
    672677@MAINTAINER_MODE_FALSE@CLEANFILES = $(COMMON_CLEANFILES)
    673678@MAINTAINER_MODE_TRUE@CLEANFILES = $(COMMON_CLEANFILES) @srcdir@/jsparse/generated/operators.h @srcdir@/jsparse/generated/keywords.h
    674 all: $(BUILT_SOURCES)
     679all: $(BUILT_SOURCES) $(OS2_DLL_NAME).dll
    675680        $(MAKE) $(AM_MAKEFLAGS) all-recursive
    676681
     
    23492354# Otherwise a system limit (for SysV at least) may be exceeded.
    23502355.NOEXPORT:
     2356
     2357$(OS2_DLL_NAME).dll: lib$(OS2_LA_NAME).la
     2358        cp .libs/$(OS2_LA_NAME).a .libs/$(OS2_LA_NAME)_s.a
     2359        echo "LIBRARY $(OS2_DLL_NAME) INITINSTANCE TERMINSTANCE" > $(OS2_DLL_NAME).def
     2360        echo "DATA MULTIPLE" >> $(OS2_DLL_NAME).def
     2361        echo "EXPORTS" >> $(OS2_DLL_NAME).def
     2362        emxexp $(OS2_DLL_OBJ) >> $(OS2_DLL_NAME).def
     2363        gcc -g -Zbin-files -Zhigh-mem -Zomf -Zdll $(OS2_DLL_NAME).def -o $@ $(OS2_DLL_OBJ) $(OS2_DLL_LIBS)
     2364        emximp -o .libs/$(OS2_LA_NAME).a $(OS2_DLL_NAME).def
     2365        emximp -o .libs/$(OS2_LA_NAME).lib $(OS2_DLL_NAME).def
  • TabularUnified clamav/trunk/libclamav/c++/configure

    r189 r191  
    1483514835        i?86|amd64|x86_64|powerpc*)
    1483614836            case "$target_os" in
    14837                 darwin*|freebsd*|openbsd*|netbsd*|dragonfly*|linux*|solaris*|win32*|mingw*)
     14837                darwin*|freebsd*|openbsd*|netbsd*|dragonfly*|linux*|solaris*|win32*|mingw*|os2*)
    1483814838                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok ($target_cpu-$target_os)" >&5
    1483914839$as_echo "ok ($target_cpu-$target_os)" >&6; }
  • TabularUnified clamav/trunk/libclamav/c++/llvm/configure

    r189 r191  
    28062806    llvm_cv_os_type="Freestanding"
    28072807    llvm_cv_platform_type="Unix" ;;
     2808  *-*-os2*)
     2809    llvm_cv_link_all_option="-Wl,--whole-archive"
     2810    llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
     2811    llvm_cv_os_type="OS/2"
     2812    llvm_cv_platform_type="Unix" ;;
    28082813  *)
    28092814    llvm_cv_link_all_option=""
     
    28562861  *-unknown-eabi*)
    28572862    llvm_cv_target_os_type="Freestanding" ;;
     2863  *-*-os2*)
     2864    llvm_cv_target_os_type="OS/2" ;;
    28582865  *)
    28592866    llvm_cv_target_os_type="Unknown" ;;
  • TabularUnified clamav/trunk/libclamav/c++/llvm/lib/System/Mutex.cpp

    r189 r191  
    7676    assert(errorcode == 0);
    7777
    78 #if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)
     78#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) && !defined(__KLIBC__)
    7979    // Make it a process local mutex
    8080    errorcode = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE);
  • TabularUnified clamav/trunk/libclamav/c++/llvm/lib/System/Unix/Path.inc

    r189 r191  
    5959#ifdef __APPLE__
    6060#include <mach-o/dyld.h>
     61#endif
     62
     63#ifdef __KLIBC__
     64#define INCL_DOS
     65#include <os2.h>
    6166#endif
    6267
     
    351356      return Path(std::string(link_path));
    352357  }
     358#elif defined(__KLIBC__)
     359    static CHAR Buff[2*_MAX_PATH];
     360    PPIB        pib;
     361    // get executable fullpath
     362    DosGetInfoBlocks( NULL, &pib);
     363    DosQueryModuleName( pib->pib_hmte, sizeof(Buff), Buff);
     364    return Path(std::string(Buff));
    353365#elif defined(__FreeBSD__)
    354366  char exe_path[PATH_MAX];
  • TabularUnified clamav/trunk/libclamav/c++/llvm/lib/System/Unix/Process.inc

    r189 r191  
    214214  unsigned Columns = 0;
    215215
     216#ifdef __KLIBC__
     217        {
     218            int screendata[2];
     219            _scrsize(screendata);
     220            Columns = screendata[0];
     221        }
     222#else
     223
    216224#if defined(HAVE_SYS_IOCTL_H) && defined(HAVE_TERMIOS_H)
    217225  // Try to determine the width of the terminal.
     
    220228    Columns = ws.ws_col;
    221229#endif
     230
     231#endif // __KLIBC__
    222232
    223233  return Columns;
  • TabularUnified clamav/trunk/libclamav/chmunpack.c

    r189 r191  
    572572        lzx_free(stream);
    573573       
    574 #ifndef _WIN32
     574#if !defined(_WIN32) && !defined(C_OS2)
    575575        /* Delete the file */
    576576        if(cli_unlink(filename))
     
    583583        if ((retval == -1) && (tmpfd >= 0)) {
    584584                close(tmpfd);
     585#if defined(_WIN32) || defined(C_OS2)
     586                /* Now delete the file */
     587                cli_unlink(filename);
     588#endif
    585589        }
    586590        return retval;
  • TabularUnified clamav/trunk/libclamav/fmap.c

    r189 r191  
    4949static inline unsigned int fmap_which_page(fmap_t *m, size_t at);
    5050
    51 #ifndef _WIN32
     51#if !defined(_WIN32) && !defined(C_OS2)
    5252/* vvvvv POSIX STUFF BELOW vvvvv */
    5353
     
    545545    pages = fmap_align_items(len, pgsz);
    546546    hdrsz = fmap_align_to(sizeof(fmap_t), pgsz);
     547    mapsz = pages * pgsz + hdrsz;
    547548
    548549    if(!(m = (fmap_t *)cli_malloc(sizeof(fmap_t)))) {
     
    550551        return NULL;
    551552    }
     553
     554#ifdef _WIN32
    552555    if((m->fh = (HANDLE)_get_osfhandle(fd)) == INVALID_HANDLE_VALUE) {
    553556        cli_errmsg("fmap: cannot get a valid handle for descriptor %d\n", fd);
     
    566569        return NULL;
    567570    }
     571#else
     572    m->data = mmap(0, len, PROT_READ, MAP_PRIVATE, fd, 0);
     573    if (m == MAP_FAILED) {
     574        cli_errmsg("fmap: cannot map file descriptor %d\n", fd);
     575        free(m);
     576        return NULL;
     577    }
     578#endif
    568579    m->fd = fd;
    569580    m->dumb = dumb;
     
    580591
    581592void funmap(fmap_t *m) { /* WIN32 */
     593#ifdef _WIN32
    582594    UnmapViewOfFile(m->data);
    583595    CloseHandle(m->mh);
     596#else
     597    munmap(m->data, 0);
     598#endif
    584599    free((void *)m);
    585600}
  • TabularUnified clamav/trunk/libclamav/fmap.h

    r189 r191  
    4545    void *data;
    4646#endif
     47#ifdef C_OS2
     48    void *data;
     49#endif
    4750    uint32_t placeholder_for_bitmap;
    4851} fmap_t;
  • TabularUnified clamav/trunk/libclamav/mpool.c

    r189 r191  
    4040#endif
    4141#include <stddef.h>
     42
     43#if defined(C_OS2)
     44#define INCL_DOS
     45#define INCL_DOSERRORS
     46#include <os2.h>
     47#endif
    4248
    4349#include "others.h"
     
    347353  mp.u.mpm.usize = sizeof(struct MPMAP);
    348354  mp.u.mpm.size = sz - sizeof(mp);
    349 #ifndef _WIN32
     355#if defined(C_OS2)
     356  if(DosAllocMem(&mpool_p, sz, PAG_READ|PAG_WRITE|PAG_COMMIT|OBJ_ANY) != NO_ERROR)
     357    if(DosAllocMem(&mpool_p, sz, PAG_READ|PAG_WRITE|PAG_COMMIT) != NO_ERROR)
     358#elif !defined(_WIN32)
    350359  if ((mpool_p = (struct MP *)mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_PRIVATE|ANONYMOUS_MAP, -1, 0)) == MAP_FAILED)
    351360#else
     
    379388    memset(mpm, FREEPOISON, mpmsize);
    380389#endif
    381 #ifndef _WIN32
     390#if defined(C_OS2)
     391    DosFreeMem(mpm);
     392#elif !defined(_WIN32)
    382393    munmap((void *)mpm, mpmsize);
    383394#else
     
    389400  memset(mp, FREEPOISON, mpmsize + sizeof(*mp));
    390401#endif
    391 #ifndef _WIN32
     402#if defined(C_OS2)
     403    DosFreeMem(mpm);
     404#elif !defined(_WIN32)
    392405  munmap((void *)mp, mpmsize + sizeof(*mp));
    393406#else
     
    412425            memset((char *)mpm + mused, FREEPOISON, mpm->size - mused);
    413426#endif
    414 #ifndef _WIN32
     427#if defined(C_OS2)
     428            DosSetMem(mpm + mused, mpm->size - mused, PAG_DECOMMIT);
     429#elif !defined(_WIN32)
    415430            munmap((char *)mpm + mused, mpm->size - mused);
    416431#else
     
    427442        memset((char *)mp + mused, FREEPOISON, mp->u.mpm.size + sizeof(*mp) - mused);
    428443#endif
    429 #ifndef _WIN32
     444#if defined(C_OS2)
     445        DosSetMem(mp + mused, mp->u.mpm.size + sizeof(*mp) - mused, PAG_DECOMMIT);
     446#elif !defined(_WIN32)
    430447        munmap((char *)mp + mused, mp->u.mpm.size + sizeof(*mp) - mused);
    431448#else
     
    545562  i = align_to_pagesize(mp, MIN_FRAGSIZE);
    546563
    547 #ifndef _WIN32
     564#if defined(C_OS2)
     565  if(DosAllocMem(&mpm, i, PAG_READ|PAG_WRITE|PAG_COMMIT|OBJ_ANY) != NO_ERROR)
     566    if(DosAllocMem(&mpm, i, PAG_READ|PAG_WRITE|PAG_COMMIT) != NO_ERROR) {
     567#elif !defined(_WIN32)
    548568  if ((mpm = (struct MPMAP *)mmap(NULL, i, PROT_READ | PROT_WRITE, MAP_PRIVATE|ANONYMOUS_MAP, -1, 0)) == MAP_FAILED) {
    549569#else
  • TabularUnified clamav/trunk/libclamav/others.c

    r189 r191  
    7070#include "bytecode_api_impl.h"
    7171
     72#ifndef C_OS2
    7273int (*cli_unrar_open)(int fd, const char *dirname, unrar_state_t *state);
    7374int (*cli_unrar_extract_next_prepare)(unrar_state_t *state, const char *dirname);
    7475int (*cli_unrar_extract_next)(unrar_state_t *state, const char *dirname);
    7576void (*cli_unrar_close)(unrar_state_t *state);
     77#endif
     78
    7679int have_rar = 0;
    7780static int is_rar_initd = 0;
     
    165168    is_rar_initd = 1;
    166169
     170#ifndef C_OS2
    167171    rhandle = lt_dlfind("libclamunrar_iface", "unrar");
    168172    if (!rhandle)
     
    178182        return;
    179183    }
     184#endif // C_OS2
     185
    180186    have_rar = 1;
    181187}
     
    739745}
    740746
    741 #ifdef  C_WINDOWS
     747#if defined(C_WINDOWS) || defined(C_OS2)
    742748/*
    743749 * Windows doesn't allow you to delete a directory while it is still open
  • TabularUnified clamav/trunk/libclamav/others.h

    r189 r191  
    3434#include <stdio.h>
    3535#include <stdlib.h>
     36#ifdef __KLIBC__
     37#include <unistd.h>
     38#endif
    3639#include "cltypes.h"
    3740
     
    286289};
    287290
     291#ifndef __KLIBC__
    288292extern int (*cli_unrar_open)(int fd, const char *dirname, unrar_state_t *state);
    289293extern int (*cli_unrar_extract_next_prepare)(unrar_state_t *state, const char *dirname);
    290294extern int (*cli_unrar_extract_next)(unrar_state_t *state, const char *dirname);
    291295extern void (*cli_unrar_close)(unrar_state_t *state);
     296#endif
    292297extern int have_rar;
    293298
  • TabularUnified clamav/trunk/libclamav/others_common.c

    r189 r191  
    115115        regex_t reg;
    116116        int match, flags = REG_EXTENDED | REG_NOSUB;
    117 #ifdef _WIN32
     117#if defined(_WIN32) || defined(C_OS2)
    118118    flags |= REG_ICASE;
    119119#endif
     
    306306}
    307307
     308
     309#ifdef __KLIBC__
     310// it seems that mmap exception handler does not work inside kernel functions,
     311// so we temporary trigger page faults before invoking write()
     312static int _writen( char* buff, unsigned int count)
     313{
     314        int i;
     315        char ch0 = buff[0];
     316        // the last byte can be on a different page
     317        buff[0] = buff[count-1];
     318        for( i=0; i<count; i+=4096)
     319                buff[0] = buff[i];
     320        // I need this to fake optimizer, otherwise loop will be removed with -O3
     321        buff[0] = ch0;
     322        return ch0;
     323}
     324#endif // __KLIBC__
     325
    308326/* Function: writen
    309327        Try hard to write the specified number of bytes
     
    318336        todo = count;
    319337        current = (const unsigned char *) buff;
     338
     339#ifdef __KLIBC__
     340        // it seems that mmap exception handler does not work inside kernel functions,
     341        // so we temporary trigger page faults before invoking write()
     342        retval = _writen( current, count);
     343#endif
    320344
    321345        do {
     
    382406        const char *tmpdir;
    383407    if(
    384 #ifdef _WIN32
     408#if defined(_WIN32) || defined(C_OS2)
    385409        !(tmpdir = getenv("TEMP")) && !(tmpdir = getenv("TMP"))
    386410#else
  • TabularUnified clamav/trunk/libclamav/readdb.c

    r189 r191  
    27032703}
    27042704
     2705const char *cl_retcfgdir(void)
     2706{
     2707    return CONFDIR;
     2708}
     2709
    27052710int cl_statinidir(const char *dirname, struct cl_stat *dbstat)
    27062711{
  • TabularUnified clamav/trunk/libclamunrar_iface/unrar_iface.h

    r189 r191  
    2525#endif
    2626
     27#ifdef __KLIBC__
     28#define unrar_open cli_unrar_open
     29#define unrar_extract_next_prepare cli_unrar_extract_next_prepare
     30#define unrar_extract_next cli_unrar_extract_next
     31#define unrar_close cli_unrar_close
     32#else
    2733#define unrar_open libclamunrar_iface_LTX_unrar_open
    2834#define unrar_extract_next_prepare libclamunrar_iface_LTX_unrar_extract_next_prepare
    2935#define unrar_extract_next libclamunrar_iface_LTX_unrar_extract_next
    3036#define unrar_close libclamunrar_iface_LTX_unrar_close
     37#endif
    3138
    3239#ifndef HAVE_ATTRIB_PACKED
  • TabularUnified clamav/trunk/libltdl/loaders/loadlibrary.c

    r189 r191  
    3232#include "lt__private.h"
    3333#include "lt_dlloader.h"
     34
     35#ifndef __KLIBC__
    3436
    3537#if defined(__CYGWIN__)
     
    250252  return address;
    251253}
     254
     255#endif // __KLIBC__
  • TabularUnified clamav/trunk/libltdl/ltdl.c

    r189 r191  
    233233      /* Now open all the preloaded module loaders, so the application
    234234         can use _them_ to lt_dlopen its own modules.  */
     235#ifndef __KLIBC__
    235236#ifdef HAVE_LIBDLLOADER
    236237      if (!errors)
     
    244245        }
    245246#endif /* HAVE_LIBDLLOADER */
     247#endif // __KLIBC__
    246248    }
    247249
  • TabularUnified clamav/trunk/shared/misc.c

    r189 r191  
    250250int daemonize(void)
    251251{
    252 #ifdef _WIN32
     252#if defined(C_OS2)
     253    return 0;
     254#elif defined(_WIN32)
    253255    fputs("Background mode is not supported on your operating system\n", stderr);
    254256    return -1;
     
    301303        int match, flags = REG_EXTENDED | REG_NOSUB;
    302304        char fname[513];
    303 #ifdef _WIN32
     305#if defined(_WIN32) || defined(C_OS2)
    304306        flags |= REG_ICASE; /* case insensitive on Windows */
    305307#endif
     
    345347
    346348int cli_is_abspath(const char *path) {
    347 #ifdef _WIN32
     349#if defined(_WIN32) || defined(C_OS2)
    348350    int len = strlen(path);
    349     return (len > 2 && path[0] == '\\' && path[1] == '\\') || (len >= 2 && ((*path >= 'a' && *path <= 'z') || (*path >= 'A' && *path <= 'Z')) && path[1] == ':');
     351    return (len > 2 && path[0] == '\\' && path[1] == '\\')
     352#ifdef C_OS2
     353        || *path == '/' || *path == '\\'
     354#endif
     355        || (len >= 2 && ((*path >= 'a' && *path <= 'z') || (*path >= 'A' && *path <= 'Z')) && path[1] == ':');
    350356#else
    351357    return *path == '/';
  • TabularUnified clamav/trunk/shared/optparser.c

    r189 r191  
    788788            for(i = 0; i < (int) strlen(pt) - 1 && (pt[i] == ' ' || pt[i] == '\t'); i++);
    789789            pt += i;
    790             for(i = strlen(pt); i >= 1 && (pt[i - 1] == ' ' || pt[i - 1] == '\t' || pt[i - 1] == '\n'); i--);
     790            for(i = strlen(pt); i >= 1 && (pt[i - 1] == ' ' || pt[i - 1] == '\t' || pt[i - 1] == '\n' || pt[i - 1] == '\r'); i--);
    791791            if(!i) {
    792792                if(verbose)
  • TabularUnified clamav/trunk/unit_tests/check_clamd.c

    r189 r191  
    5151#include "libclamav/cltypes.h"
    5252
     53#ifdef __KLIBC__
     54#define SHUT_WR 0
     55#endif
     56
    5357#ifdef CHECK_HAVE_LOOPS
    5458
    5559static int sockd;
    56 #define SOCKET "clamd-test.socket"
     60#define SOCKET "\\socket\\clamd-test.socket"
    5761static void conn_setup_mayfail(int may)
    5862{
     
    398402static int sendmsg_fd(int sockd, const char *mesg, size_t msg_len, int fd, int singlemsg)
    399403{
     404#ifndef __KLIBC__
    400405    struct msghdr msg;
    401406    struct cmsghdr *cmsg;
     
    438443
    439444    return sendmsg(sockd, &msg, 0);
     445#endif // __KLIBC__
    440446}
    441447
Note: See TracChangeset for help on using the changeset viewer.