`ad ls` is supposed to work on non AFP volumes too, but afaict after your change it will only work on AFP volumes.
A better fix would be something like

    openvol(obj, ".", &vol);
    ad_ls_r(".", &vol);
    if (vol_is_really_open(vol))
        closevol(&vol);

You'll have to look into openvol() in order to find which member of the struct pointed to by vol may be suitable to determine whether the openvol() call succeeded or failed.