X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fseshigh.c;h=3e10403b25b5e0a7a8a1ba0896b105f6ba1b812d;hp=a0d79fa7760afd31130989b3dcbc5c807361ed3a;hb=1aef63af06fa380247c91d12cd7288981985a406;hpb=b3d5a30f4d074053085693a8fc5381a4ebc41544 diff --git a/src/seshigh.c b/src/seshigh.c index a0d79fa..3e10403 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -735,29 +735,7 @@ static int srw_bend_fetch(association *assoc, int pos, if (rr.errcode && rr.surrogate_flag) { int code = yaz_diag_bib1_to_srw(rr.errcode); - const char *message = yaz_diag_srw_str(code); - int len = 200; - if (message) - len += strlen(message); - if (rr.errstring) - len += strlen(rr.errstring); - - record->recordData_buf = (char *) odr_malloc(o, len); - - sprintf(record->recordData_buf, "\n" - " info:srw/diagnostic/1/%d\n", code); - if (rr.errstring) - sprintf(record->recordData_buf + strlen(record->recordData_buf), - "
%s
\n", rr.errstring); - if (message) - sprintf(record->recordData_buf + strlen(record->recordData_buf), - " %s\n", message); - sprintf(record->recordData_buf + strlen(record->recordData_buf), - "
\n"); - record->recordData_len = strlen(record->recordData_buf); - record->recordPosition = odr_intdup(o, pos); - record->recordSchema = "info:srw/schema/1/diagnostics-v1.1"; + yaz_mk_sru_surrogate(o, record, pos, code, rr.errstring); return 0; } else if (rr.len >= 0) @@ -765,7 +743,8 @@ static int srw_bend_fetch(association *assoc, int pos, record->recordData_buf = rr.record; record->recordData_len = rr.len; record->recordPosition = odr_intdup(o, pos); - record->recordSchema = odr_strdup_null(o, rr.schema); + record->recordSchema = odr_strdup_null( + o, rr.schema ? rr.schema : srw_req->recordSchema); } if (rr.errcode) {