stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: [patch] exec utility child process limits (unix)
Date Tue, 12 Sep 2006 01:24:43 GMT
Andrew Black wrote:
> And take 3, log below (slightly modified from last time).
> 

The --ulimit command line option doesn't seem to work at all (it
gives an error no matter how I try to use it). Stepping through
the code, it seems that the problem might be an off-by-1 error
in eval_options.

[...]
> @@ -397,7 +574,16 @@
>                      }
>                  }
>              }
> -
> +            else if (   sizeof opt_ulimit <= arglen
> +                     && !memcmp (opt_ulimit, argv [i], sizeof opt_ulimit - 1))
{
> +                optname = opt_ulimit;
> +                optarg  = get_long_val (argv, &i, sizeof opt_ulimit);

Shouldn't this be instead:

     get_long_val (argv, &i, sizeof opt_ulimit - 1);

[...]
> Index: cmdopt.h
> ===================================================================
> --- cmdopt.h	(revision 441643)
> +++ cmdopt.h	(working copy)
> @@ -27,6 +27,10 @@
>  #ifndef RW_PARSE_OPTS_H
>  #define RW_PARSE_OPTS_H
>  
> +#if !defined (_WIN32) && !defined (_WIN64)
> +#  include <unistd.h> /* For _XOPEN_UNIX */
> +#endif
> +
>  extern int timeout;
>  extern int compat;
>  extern unsigned verbose; /**< Verbose output mode switch.  Defaults to 0 */
> @@ -39,6 +43,41 @@
>  extern const char suffix_sep; /**< File suffix seperator. */
>  extern const size_t exe_suffix_len; /**< Length of executable suffix. */
>  
> +#ifdef _XOPEN_UNIX
> +#  include <sys/resource.h> /* for struct rlimit */
> +/**
> +   Abstraction typedef for struct rlimit using real struct
> +*/
> +typedef struct rlimit rw_rlimit;
> +#else
> +/**
> +   Placeholder rlim_t for use in rw_rlimit
> +*/
> +typedef unsigned long rw_rlim_t

Missing semicolon at the end of the typedef? If this code is compiled
with MSVC or Intel C++ on Windows we'd get an error. Could you please
make sure the patch doesn't break windows builds?

Thanks
Martin

Mime
View raw message