为什麽u_open()执行会出错

weixin_38063619 weixin_38063619 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

我有一段这样的程序,
#define FIFO_PATH "/tmp/.asppp.fifo"
STATUS solaris_ppp_init
    (
    int ppp_fd
    )
    {
    char            buf[256];
    char            name[64];       /* user name string */
    struct strbuf   data;
    register int    fd;             /* FIFO to aspppd */
    union fifo_msgs *fifo_msg;
    int             retries;

    /*
     * Simple protocol, send:
     *
     *      user name and trailing null
     *      file descriptor (could be stdin or stdout) that remote end
     *      connected on
     */

    sprintf(name, "vxsim%d", sysProcNumGet());

    /*
     * sometimes we need to let asppd clean up a previous connection
     * so retry the open a few times
     */

    for (retries=0, fd=-1; retries < 4 && fd < 0; retries++)
        if ((fd = u_open(FIFO_PATH, O_WRONLY, 0)) < 0)
            u_sleep(1);  

    if (fd < 0)
        {
        u_printf("Can't open %s\n", FIFO_PATH);
        return(ERROR);
        }

#if FALSE
  
    /* set a high debug level in the Solaris PPP driver */

    data.buf = buf;
    data.len = sizeof (debug_t);
    data.maxlen = sizeof (debug_t);
    fifo_msg = (union fifo_msgs *)data.buf;
    fifo_msg->;msg = FIFO_DEBUG;
    fifo_msg->;debug.debug_level = 42;

    if (u_putmsg (fd, NULL, &data, 0) < 0)
        {
        u_printf("Can't send name to aspppd\n"
        u_close(fd);
        return(ERROR);
        }
#endif

    data.buf = buf;
    data.len = sizeof (uname_t);
    fifo_msg = (union fifo_msgs *)data.buf;
    fifo_msg->;msg = FIFO_UNAME;
    strcpy(fifo_msg->;uname.uname, name);

    if (u_putmsg (fd, NULL, &data, 0) < 0)
        {
        u_printf("Can't send name to aspppd\n"
        u_close(fd);
        return(ERROR);
        }

    if (u_ioctl(fd, I_SENDFD, (void *)ppp_fd) < 0)
        {
        u_printf("Can't send local fd to aspppd\n"
        u_close(fd);
        return(ERROR);
        }

    return(OK);
    }
在一个纯英文的Solaris8系统上没有问题,但是在一个安装了中文Solaris8的系统上(在CDE登陆时已经选择为英文环境),但是会打印Can't open /tmp/.asppp.fifo,u_open()函数的使用还会与什麽系统设置有关?
谢谢!!!!
...全文

相关推荐

评论
收藏 已收藏
分享
返回顶部