File perl-Socket-MsgHdr.diff of Package perl-Socket-MsgHdr

--- ./MsgHdr.xs.orig	2010-01-07 03:35:06.000000000 +0000
+++ ./MsgHdr.xs	2010-01-07 11:20:12.000000000 +0000
@@ -147,11 +147,11 @@ smh_recvmsg(s, msg_hdr, flags = 0)
 
         hsh = (HV*) SvRV(msg_hdr);
 
-        if ((svp = hv_fetch(hsh, "name", 4, FALSE)))
+        if ((svp = hv_fetch(hsh, "name", 4, FALSE)) && SvOK(*svp))
             SvCUR_set(*svp, mh.m.msg_namelen);
-        if ((svp = hv_fetch(hsh, "buf", 3, FALSE)))
+        if ((svp = hv_fetch(hsh, "buf", 3, FALSE)) && SvOK(*svp))
             SvCUR_set(*svp, RETVAL);
-        if ((svp = hv_fetch(hsh, "control", 7, FALSE)))
+        if ((svp = hv_fetch(hsh, "control", 7, FALSE)) && SvOK(*svp))
             SvCUR_set(*svp, mh.m.msg_controllen);
     }
     OUTPUT:
--- ./lib/Socket/MsgHdr.pm.orig	2010-01-07 03:50:56.000000000 +0000
+++ ./lib/Socket/MsgHdr.pm	2010-01-07 11:19:14.000000000 +0000
@@ -39,6 +39,10 @@ INIT {
     no strict 'refs';
     *{$attr . "len"} = sub {
       my $self = shift;
+      if (!defined($self->{$attr})) {
+        return 0 unless @_;
+        $self->{$attr} = '';
+      }
       my $olen = length($self->$attr);
       return $olen unless @_;
       my $nlen = shift;
openSUSE Build Service is sponsored by