File: //lib64/python3.9/site-packages/borg/platform/__pycache__/xattr.cpython-39.pyc
a
HZ�hJ � @ s� d dl Z d dlZddlmZ z
e jZW n ey> e jZY n0 eedd�Zdd� Z dd � Z
G d
d� de�Zdd
d�Z
dd� Zdd� Zdd� ZdS )� N� )�Bufferi )�limitc C s$ t | t�rt| �} | �d�dd� S )zMsplit a list of zero-terminated strings into python not-zero-terminated bytes� N���)�
isinstance� bytearray�bytes�split)�buf� r �9/usr/lib64/python3.9/site-packages/borg/platform/xattr.py�
split_string0 s
r c C sH g }t | �}|rD|d }|�t|dd| � �� |d| d� }q|S )zMsplit a list of length-prefixed strings into python not-length-prefixed bytesr � N)�
memoryview�appendr )r �result�mv�lengthr r r
�
split_lstring s r c @ s e Zd ZdZdS )�BufferTooSmallErrorzBthe buffer given to a xattr function was too small for the result.N)�__name__�
__module__�__qualname__�__doc__r r r r
r # s r Fc C s� ddl m} | dk rr|� }|r.|tjkr.t�nDzt�|�}W n tyR d}Y n0 t|t �rfd| }t
|||��|r�| tt�kr�t�| S )Nr )� get_errnor � z<FD %d>)
r r �errnoZERANGEr �os�strerror�
ValueErrorr �int�OSError�len�buffer)�rv�path�detect_buffer_too_smallr �e�msgr r r
�_check'