Revision f7c31d63 net.c

b/net.c
774 774

  
775 775
int net_handle_fd_param(Monitor *mon, const char *param)
776 776
{
777
    if (!qemu_isdigit(param[0])) {
778
        int fd;
777
    int fd;
778

  
779
    if (!qemu_isdigit(param[0]) && mon) {
779 780

  
780 781
        fd = monitor_get_fd(mon, param);
781 782
        if (fd == -1) {
782 783
            error_report("No file descriptor named %s found", param);
783 784
            return -1;
784 785
        }
785

  
786
        return fd;
787 786
    } else {
788
        return strtol(param, NULL, 0);
787
        char *endptr = NULL;
788

  
789
        fd = strtol(param, &endptr, 10);
790
        if (*endptr || (fd == 0 && param == endptr)) {
791
            return -1;
792
        }
789 793
    }
794

  
795
    return fd;
790 796
}
791 797

  
792 798
static int net_init_nic(QemuOpts *opts,

Also available in: Unified diff