hibernate-resume-generator.c revision da927ba997d68401563b927f92e6e40e021a8e5c
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2014 Ivan Shapovalov
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdio.h>
#include <errno.h>
#include "log.h"
#include "util.h"
#include "special.h"
#include "mkdir.h"
#include "unit-name.h"
static const char *arg_dest = "/tmp";
static char *arg_resume_dev = NULL;
if (!arg_resume_dev)
return log_oom();
}
return 0;
}
static int process_resume(void) {
if (!arg_resume_dev)
return 0;
if (!name)
return log_oom();
if (!lnk)
return log_oom();
return -errno;
}
return 0;
}
int r = 0;
log_error("This program takes three or no arguments.");
return EXIT_FAILURE;
}
if (argc > 1)
log_open();
umask(0022);
/* Don't even consider resuming outside of initramfs. */
if (!in_initrd())
return EXIT_SUCCESS;
if (r < 0)
log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m");
r = process_resume();
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}