hibernate-resume-generator.c revision b26fa1a2fbcfee7d03b0c8fd15ec3aa64ae70b9f
/***
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 <errno.h>
#include <stdio.h>
#include "alloc-util.h"
#include "fstab-util.h"
#include "log.h"
#include "mkdir.h"
#include "proc-cmdline.h"
#include "special.h"
#include "string-util.h"
#include "unit-name.h"
#include "util.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) {
int r;
if (!arg_resume_dev)
return 0;
if (r < 0)
return log_error_errno(r, "Failed to generate unit name: %m");
if (!lnk)
return log_oom();
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;
}