]> arthur.barton.de Git - bup.git/commitdiff
Get SC_ARG_MAX from os.sysconf(), not C
authorRob Browning <rlb@defaultvalue.org>
Sun, 28 Jun 2015 16:35:36 +0000 (11:35 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 28 Jun 2015 16:39:47 +0000 (11:39 -0500)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/_helpers.c
lib/bup/helpers.py

index cfdbc8afcfbc11171db504ee8dcd0ea6c8320ddf..88653ac94a53ebcdf184ba96e88b9e2cdf5980c2 100644 (file)
@@ -1516,18 +1516,6 @@ PyMODINIT_FUNC init_helpers(void)
         Py_DECREF(value);
     }
 #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");
index f1c6084e5528a18ffdefa8e0dc808f982bf607c1..9e428845be0002bb4eb152125175595b75fabd97 100644 (file)
@@ -9,6 +9,8 @@ import hashlib, heapq, math, operator, time, grp, tempfile
 
 from bup import _helpers
 
+sc_arg_max = os.sysconf('SC_ARG_MAX')
+
 # This function should really be in helpers, not in bup.options.  But we
 # want options.py to be standalone so people can include it in other projects.
 from bup.options import _tty_width
@@ -214,7 +216,7 @@ def _argmax_args_size(args):
     return sum(len(x) + 1 + sizeof(c_void_p) for x in args)
 
 
-def batchpipe(command, args, preexec_fn=None, arg_max=_helpers.SC_ARG_MAX):
+def batchpipe(command, args, preexec_fn=None, arg_max=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)."""