Skip to content

redundant code #109

@benwaffle

Description

@benwaffle
void gt::Platform::makeSharedFile()
{
    if(processIsUnique() && !checkDirExist("/tmp/gfeed")) //If the pipe already exists we'll just use it
        if(mkfifo("/tmp/gfeed", 0755) == -1)
            throw std::runtime_error("Couldn't create pipe! Check your permissions or if /tmp/gfeed exists");
    fd = open("/tmp/gfeed", O_RDONLY | O_NONBLOCK); // TODO: use streams
    if(fd == -1)
        throw std::runtime_error("Couldn't open pipe");
    if(ld == -1)
        ld = open("/var/lock/gtorrent.lock", O_CREAT | O_RDONLY, 0600);
    if(ld == -1)
        throw std::runtime_error("Couldn't open pipe");
    processIsUnique(); // a call here to lock the file
}
  • /var/lock/gtorrent.lock is not the path we use for the lock
  • the ld == -1 checks are redundant since processIsUnique will not return until ld != -1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions