* [PATCH 1/9] fdisk: extend comments for fdisk_new_context()
@ 2012-06-17 16:09 Davidlohr Bueso
2012-06-21 6:10 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Davidlohr Bueso @ 2012-06-17 16:09 UTC (permalink / raw)
To: Karel Zak, Petr Uzel; +Cc: util-linux
From: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
fdisk/utils.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/fdisk/utils.c b/fdisk/utils.c
index 352a934..5bb4984 100644
--- a/fdisk/utils.c
+++ b/fdisk/utils.c
@@ -147,6 +147,12 @@ void fdisk_init_debug(int mask)
/**
* fdisk_new_context:
+ * @filename: path to the device to be handled
+ * @readonly: how to open the device
+ *
+ * If the @readonly flag is set to false, fdisk will attempt to open
+ * the device with read-write mode and will fallback to read-only if
+ * unsuccessful.
*
* Returns: newly allocated fdisk context
*/
@@ -155,10 +161,6 @@ struct fdisk_context *fdisk_new_context_from_filename(const char *fname, int rea
int fd, errsv = 0;
struct fdisk_context *cxt = NULL;
- /*
- * Attempt to open the device with r-w permissions
- * by default, otherwise try read-only.
- */
if (readonly == 1 || (fd = open(fname, O_RDWR)) < 0) {
if ((fd = open(fname, O_RDONLY)) < 0)
return NULL;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-21 6:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-17 16:09 [PATCH 1/9] fdisk: extend comments for fdisk_new_context() Davidlohr Bueso
2012-06-21 6:10 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).