- if (nfs_version & 0x1)
- rpc_init("mountd", MOUNTPROG, MOUNTVERS,
- mount_dispatch, port);
- if (nfs_version & (0x1 << 1))
- rpc_init("mountd", MOUNTPROG, MOUNTVERS_POSIX,
- mount_dispatch, port);
- if (nfs_version & (0x1 << 2))
- rpc_init("mountd", MOUNTPROG, MOUNTVERS_NFSV3,
- mount_dispatch, port);
+ unregister_services();
+ if (version2()) {
+ listeners += nfs_svc_create("mountd", MOUNTPROG,
+ MOUNTVERS, mount_dispatch, port);
+ listeners += nfs_svc_create("mountd", MOUNTPROG,
+ MOUNTVERS_POSIX, mount_dispatch, port);
+ }
+ if (version3())
+ listeners += nfs_svc_create("mountd", MOUNTPROG,
+ MOUNTVERS_NFSV3, mount_dispatch, port);
+ if (version23() && listeners == 0)
+ xlog(L_FATAL, "mountd: could not create listeners\n");