if (m == NULL)
return;
-#ifdef HAVE_UTIMENSAT
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wtautological-compare" // For INTEGER_TO_PY().
+#ifdef HAVE_UTIMENSAT
{
PyObject *value;
value = INTEGER_TO_PY(AT_FDCWD);
PyObject_SetAttrString(m, "UTIME_NOW", value);
Py_DECREF(value);
}
-#pragma clang diagnostic pop // ignored "-Wtautological-compare"
#endif
+ {
+ PyObject *value;
+ const long arg_max = sysconf(_SC_ARG_MAX);
+ if (arg_max == -1)
+ {
+ fprintf(stderr, "Cannot find SC_ARG_MAX, please report a bug.\n");
+ exit(1);
+ }
+ value = INTEGER_TO_PY(arg_max);
+ PyObject_SetAttrString(m, "SC_ARG_MAX", value);
+ Py_DECREF(value);
+ }
+#pragma clang diagnostic pop // ignored "-Wtautological-compare"
e = getenv("BUP_FORCE_TTY");
istty2 = isatty(2) || (atoi(e ? e : "0") & 2);
return out
-try:
- _arg_max = os.sysconf('SC_ARG_MAX')
- if _arg_max == -1:
- raise ValueError()
-except ValueError, ex:
- print >> sys.stderr, 'Cannot find SC_ARG_MAX, please report a bug.'
- sys.exit(1)
-
-
def _argmax_base(command):
base_size = 2048
for c in command:
return sum(len(x) + 1 + sizeof(c_void_p) for x in args)
-def batchpipe(command, args, preexec_fn=None, arg_max=None):
+def batchpipe(command, args, preexec_fn=None, arg_max=_helpers.SC_ARG_MAX):
"""If args is not empty, yield the output produced by calling the
command list with args as a sequence of strings (It may be necessary
to return multiple strings in order to respect ARG_MAX)."""
# The optional arg_max arg is a workaround for an issue with the
# current wvtest behavior.
- if not arg_max:
- arg_max = _arg_max
base_size = _argmax_base(command)
while args:
room = arg_max - base_size