VirtualBox

Changeset 102994 in vbox for trunk/include


Ignore:
Timestamp:
Jan 22, 2024 6:06:29 PM (16 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
161226
Message:

iprt: Add wrapper for strlcpy/strscpy functions, build fix, bugref:10584.

Another way around to suppress build error when strscpy return status
is not used. Also, turn macro into strlcpy for non-Linux systems,
so for them it will be no change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/string.h

    r102993 r102994  
    260260#if defined(RT_OS_LINUX) && defined(__KERNEL__)
    261261# if (RTLNX_VER_MIN(4,3,0))
    262 #  define RT_STRSCPY(a_pDst, a_pSrc, a_cbDst)   (void)strscpy((a_pDst), (a_pSrc), (a_cbDst))
     262#  define RT_STRSCPY(a_pDst, a_pSrc, a_cbDst) \
     263    { \
     264      ssize_t _ret; \
     265      _ret = strscpy((a_pDst), (a_pSrc), (a_cbDst)); \
     266    }
    263267# else /* < 3.16.60 */
    264268#  define RT_STRSCPY(a_pDst, a_pSrc, a_cbDst)   strlcpy((a_pDst), (a_pSrc), (a_cbDst))
    265269# endif
    266270#else  /* !RT_OS_LINUX && !__KERNEL__ */
    267 # define RT_STRSCPY(a_pDst, a_pSrc, a_cbDst)    (void)strscpy((a_pDst), (a_pSrc), (a_cbDst))
     271# define RT_STRSCPY(a_pDst, a_pSrc, a_cbDst)    strlcpy((a_pDst), (a_pSrc), (a_cbDst))
    268272#endif /* !RT_OS_LINUX && !__KERNEL__ */
    269273
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette