Skip to content

Do not hardcode error numbers

Mattias Ellert requested to merge ellert/gfal2:dont-harcode-error-number into develop

The error numbers defined on Linux can not be reused on other systems since this causes clashes.

On Linux ECHRNG is 44, but defining ECHRNG to be 44 on systems that do not define ECHRNG is not appropriate. On e.g. kFreeBSD this will clash with ESOCKTNOSUPPORT, which is defined as 44 on that system.

On Linux ECOMM is 70, but defining ECOMM to be 70 on systems that do not define ECOMM is not appropriate. On e.g. kFreeBSD this will clash with ESTALE, which is defined as 70 on that system.

Mapping ECHRNG to EINVAL matches xrootd: https://github.com/xrootd/xrootd/blob/master/src/XrdPosix/XrdPosixMap.cc#L47-L49

The Mapping of ECOMM needs to match the rest of gfal2, since different parts talk to each other. ECOMM is mapped to EIO everywhere:

https://gitlab.cern.ch/dmc/gfal2/-/blob/develop/src/plugins/lfc/gfal_lfc_open.c#L26-L28

https://gitlab.cern.ch/dmc/gfal2/-/blob/develop/src/plugins/lfc/lfc_ifce_ng.c#L25-L27

https://gitlab.cern.ch/dmc/gfal2/-/blob/develop/src/plugins/rfio/gfal_rfio_plugin_bindings.c#L29-L31

https://gitlab.cern.ch/dmc/gfal2/-/blob/develop/src/plugins/gridftp/gridftpwrapper.cpp#L522-L524

https://gitlab.cern.ch/dmc/gfal2/-/blob/develop/src/plugins/http/gfal_http_plugin.cpp#L871-L875

except this one, which is changed to EIO in this merge request:

https://gitlab.cern.ch/ellert/gfal2/-/blob/develop/src/utils/mds/gfal_mds_internal.c#L33-L35

It also matches the srm-ifce:

https://gitlab.cern.ch/dmc/srm-ifce/-/blob/develop/src/gfal_srm_ifce_types.h#L47-L49

Merge request reports