mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-17 22:14:53 +02:00
Fix building on the usual ancient Linux distro suspects
Detect if librsync is new enough to have rs_sig_args
This commit is contained in:
@@ -24,11 +24,13 @@ begin_create_signature(PyObject *self UNUSED, PyObject *args) {
|
||||
if (!PyArg_ParseTuple(args, "|Ll", &file_size, &sl)) return NULL;
|
||||
rs_magic_number magic_number = 0;
|
||||
size_t block_len = 0, strong_len = sl;
|
||||
#ifdef KITTY_HAS_RS_SIG_ARGS
|
||||
rs_result res = rs_sig_args(file_size, &magic_number, &block_len, &strong_len);
|
||||
if (res != RS_DONE) {
|
||||
PyErr_SetString(PyExc_ValueError, rs_strerror(res));
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
rs_job_t *job = rs_sig_begin(block_len, strong_len, magic_number);
|
||||
if (!job) return PyErr_NoMemory();
|
||||
PyObject *ans = PyCapsule_New(job, JOB_CAPSULE, free_job_capsule);
|
||||
|
||||
Reference in New Issue
Block a user