1/*- 2 * Copyright (c) 2006 Joseph Koshy 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 57 unchanged lines hidden (view full) --- 66 error = LIBELF_PRIVATE(error); 67 68 oserr = error >> LIBELF_OS_ERROR_SHIFT; 69 error &= LIBELF_ELF_ERROR_MASK; 70 71 if (error < 0 || error >= ELF_E_NUM) 72 return _libelf_errors[ELF_E_NUM]; 73 if (oserr) { |
74 strncpy(LIBELF_PRIVATE(msg), _libelf_errors[error], |
75 sizeof(LIBELF_PRIVATE(msg))); |
76 strncat(LIBELF_PRIVATE(msg), ": ", sizeof(LIBELF_PRIVATE(msg))); 77 strncat(LIBELF_PRIVATE(msg), strerror(oserr), |
78 sizeof(LIBELF_PRIVATE(msg))); 79 return (const char *)&LIBELF_PRIVATE(msg); 80 } 81 return _libelf_errors[error]; 82} |