On Wed, 2008-09-10 at 16:00 -0600, Latchesar Ionkov wrote:
>
> On Sep 10, 2008, at 3:52 PM, Abhishek Kulkarni wrote:
>
> >
> > 1) _GNU_SOURCE needs to be defined for strerror_r to work correctly in
> > libnpfs/error.c
>
> No, if it needs to be defined, we need to find out another way of
> getting that result. I don't want to make xcpu work only on GNU OSes.
>
Fair enough. It makes complete sense to me. It's already in a bunch of
places though (in libspfs too).
The way to deal with strerror_r would be to use the XSI compliant
version of the function.
Index: libnpfs/error.c
===================================================================
--- libnpfs/error.c (revision 693)
+++ libnpfs/error.c (working copy)
@@ -152,10 +152,10 @@
void
np_suerror(char *s, int ecode)
{
- char err[256], *str;
+ char err[256];
char buf[512];
- str = strerror_r(ecode, err, sizeof(err));
- snprintf(buf, sizeof(buf), "%s: %s", s, str);
+ strerror_r(ecode, err, sizeof(err));
+ snprintf(buf, sizeof(buf), "%s: %s", s, err);
np_werror(buf, ecode);
}
Index: libspfs/error.c
===================================================================
--- libspfs/error.c (revision 693)
+++ libspfs/error.c (working copy)
@@ -20,7 +20,6 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
-#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -92,10 +91,10 @@
void
sp_suerror(char *s, int ecode)
{
- char err[256], *str;
+ char err[256];
char buf[512];
- str = strerror_r(ecode, err, sizeof(err));
- snprintf(buf, sizeof(buf), "%s: %s", s, str);
+ strerror_r(ecode, err, sizeof(err));
+ snprintf(buf, sizeof(buf), "%s: %s", s, err);
sp_werror(buf, ecode);
}
> >
> >
> > 2) After the error handling changes in utils, local errors are not
> > registered properly as xp_nodeerror takes into account errors returned
> > by the remote nodes only. This patch makes sure we return errors
> > correctly, local or remote.
> >
> > Signed-off-by: Abhishek Kulkarni <[EMAIL PROTECTED]>
> > <all.patch>
>