Skip to content
Snippets Groups Projects
  • William Manley's avatar
    6bf55255
    listxattr: Don't assume that first call to listxattr gives correct size · 6bf55255
    William Manley authored
    To get the right sized buffer to pass to `flistattr` and `llistattr` we
    first call them with a zero byte buffer.  They then return the number of
    bytes they'll actually need to operate.  We would `malloc` and then call
    again assuming that the size we got originally was correct.
    
    On my computer at least this isn't always the case.  I've seen instances
    where the first call returns 23B, but then on the second one returns no
    data at all.  Getting these non-existant xattrs would then cause ostree
    to fail.
    
    I'm not sure why it's behaving this way on my machine.  I suspect its some
    interaction with overlayfs but I haven't proven this.
    6bf55255
    History
    listxattr: Don't assume that first call to listxattr gives correct size
    William Manley authored
    To get the right sized buffer to pass to `flistattr` and `llistattr` we
    first call them with a zero byte buffer.  They then return the number of
    bytes they'll actually need to operate.  We would `malloc` and then call
    again assuming that the size we got originally was correct.
    
    On my computer at least this isn't always the case.  I've seen instances
    where the first call returns 23B, but then on the second one returns no
    data at all.  Getting these non-existant xattrs would then cause ostree
    to fail.
    
    I'm not sure why it's behaving this way on my machine.  I suspect its some
    interaction with overlayfs but I haven't proven this.