If sharetab isn't opened, open it with fopen() instead of
freopen() to avoid segfault if it doesn't exist.